Skip to main content
Community site session details

Community site session details

Session Id : ElJ8NpAbbA9TJXglU2Wfi/
Power Apps - Building Power Apps
Answered

Writing multiple people from people picker back to SharePoint

Like (0) ShareShare
ReportReport
Posted on 6 Jul 2020 18:56:04 by

I'm new to PowerApps

 

I'm building a form which which populates a sharepoint list with some data. Among other things on my form i have 2 combo box people pickers, one for Owner which allows the selection of 1 person and one for members which allows multiple selections.

 

The Owners combo box has the following in the Items property

 

 

Office365Users.SearchUser({searchTerm:cb_Owner.SearchText})

 

 

While Members has the following

 

 

Office365Users.SearchUser({searchTerm:cb_members.SearchText})

 

 

I have a button which posts the data to sharepoint with the following OnSelect

 

 

Collect(
 MSTSFormList,
 {
 Title: Label1.Text,
 TeamType: DD_TeamType.Selected.'Template id',
 Owner: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & Lower(cb_Owner.Selected.Mail)
 },
 Members: Table( {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & Lower(cb_members.Selected.Mail)
 }
 )
 }
)

 

 

Everything else works works fine however I'm struggling to get members to work. All it does is output the last person that was entered in the the members box, instead of all of them. This does make sense to me as I can see I need to put multiple entries in the table section of the collect, however I'm unsure how to go about this. I've been looking at using ForAll or possibly creating variables that I could put here but I can't figure it out.

 

Any help would be appreciated.

 

Thanks!

 

  • gcnaren Profile Picture
    22 on 21 Oct 2021 at 08:09:50
    Re: Writing multiple people from people picker back to SharePoint

    HI ,


    Regarding above solution, Can you please suggest if this works for Submitform? I tried to add the code as below on Update property of the Datacard and I am getting "Expecting Record error"

     

     


    ForAll(DataCardValue19.SelectedItems,
    {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "i:0#.f|membership|" & ThisRecord.Email,
    Department: "",
    DisplayName: DisplayName,
    Email: Email,
    JobTitle: "",
    Picture: ""
    )}


    Can you please suggest if I am doing anyting wrong here.

     

     

    BTW, My default property of the field is as I have to set logged in user as default.

     

    If(NewRequest.Mode= FormMode.New ,{
    DisplayName: User().FullName,
    Claims: "i:0#.f|membership|" & User().Email
    })

  • Ali123 Profile Picture
    127 on 23 Sep 2021 at 10:38:52
    Re: Writing multiple people from people picker back to SharePoint

    This really works

     

  • mguerra Profile Picture
    69 on 13 Oct 2020 at 15:15:38
    Re: Writing multiple people from people picker back to SharePoint
    Hi, how are you patching this? From your gif file seems like upon running the code above it writes to the SharePoint list/library but I suspect that is not the case. Appreciate your response.
  • Community Power Platform Member Profile Picture
    on 07 Jul 2020 at 12:49:34
    Re: Writing multiple people from people picker back to SharePoint

    @mdevaney thanks for taking the time reply. I tried your solution but unfortunately I was getting a '!Required info' error in SharePoint. 

    @v-bofeng-msft solution has fixed it for me.

    Thank you both

  • Community Power Platform Member Profile Picture
    on 07 Jul 2020 at 12:46:39
    Re: Writing multiple people from people picker back to SharePoint

    That's done it, thank you very much!!

    Knew I was on the right lines but you've just saved me several more hours of banging my head off the wall.

    Thanks again

  • mdevaney Profile Picture
    29,987 Moderator on 07 Jul 2020 at 11:58:46
    Re: Writing multiple people from people picker back to SharePoint

    @v-bofeng-msft 
    It is not necessary to write this long block of code if the Owner and Members are found in a ComboBox.

    Owner: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(cb_Owner.Selected.Mail)
     },
     Members: ForAll(
     cb_members.SelectedItems,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Department: "",
     Claims: "i:0#.f|membership|" & Mail,
     DisplayName: DisplayName,
     Email: Mail,
     JobTitle: "",
     Picture: ""
     })
     }

     

    As I said in my post above, the original poster can simply do this

    Owner: cb_owner.Selected,
    Members: cb_members.SelectedItems

     

    @Anonymous 
    I suggest you do it the simple way I suggested in my 1st post.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    v-bofeng-msft Profile Picture
    on 07 Jul 2020 at 06:04:06
    Re: Writing multiple people from people picker back to SharePoint

    Hi @Anonymous :

    Do you want to update multiple users to the Member field?

    My method is to use the Forall function:

    Please try this code:

     

    Collect(
     MSTSFormList,
     {
     Title: Label1.Text,
     TeamType: DD_TeamType.Selected.'Template id',
     Owner: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(cb_Owner.Selected.Mail)
     },
     Members: ForAll(
     cb_members.SelectedItems,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Department: "",
     Claims: "i:0#.f|membership|" & Mail,
     DisplayName: DisplayName,
     Email: Mail,
     JobTitle: "",
     Picture: ""
     })
     }
    )

     

     62.gif

    Best Regards,

    Bof

  • mdevaney Profile Picture
    29,987 Moderator on 06 Jul 2020 at 21:03:47
    Re: Writing multiple people from people picker back to SharePoint

    @Anonymous 
    You don't have to write all that complicated code.  Just do what I have shown below.

    Collect(
     MSTSFormList,
     {
     Title: Label1.Text,
     TeamType: DD_TeamType.Selected.'Template id',
     Owner: cb_Owner.Selected
     Members: cb_Members.SelectedItems
     }
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete