Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Use Office365Users.SearchUserV2() with a multi-selct people picker

(1) ShareShare
ReportReport
Posted on by 37
What is the correct set up for each property listed below when using Office365Users.SearchUserV2() with a multi-select people picker field within a Power apps form?
 
Note: SharePoint list is a multi-select person field 
Should a drop down or combobox be used in the Power Apps form
 -Item
 -DefaultSelectedItems
 -Update
 - any other properties that are required to patch a SP list in new and edit modes.

Hows does one Patch a multi-selct people picker field to Sharepoint list in new mode and edit mode
 
There is no documentation that tells the full story of a form field using Office365Users.SearchUserV2()with a multi-select people picker field
 
As you can see i need help!!!
  • WarrenBelz Profile Picture
    WarrenBelz 145,666 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    Firstly the multi-person Patch schema is correct except you do not need the '@odata.type' reference any more. You can also do a more specific reference with the ID as below, but I do not think that is your issue. Have you tested sending the Person field on its own as the error may be in one of the other field references.
    Patch(
       '📝 FUP - 2.2';
       {
          ID: GalleryBU.Selected.ID;
          Title: "";
          History_PendingTasks: ("(" & Now() & ") " & User().FullName & ": " & RichTextEditor1.HtmlText & Char(13) & GalleryBU.Selected.History_PendingTasks);
          Task_responsible: 
          ForAll(
             CB_TaskHolders.SelectedItems As aPerson;
             {
                Claims: "i:0#.f|membership|" & Lower(aPerson.Mail);
                Department: "";
                DisplayName: aPerson.DisplayName;
                Email: aPerson.Mail;
                JobTitle: "";
                Picture: ""
             }
          )
       }
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Larifogo Profile Picture
    Larifogo 10 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    @WarrenBelz I also have the same issue, but your resolution is not solving, unfortunatelly.

    Here is my CB Items property:
    Filter(
        UsuáriosdoOffice365.SearchUserV2(
            {
                isSearchTermRequired: false;
                searchTerm: (Self.SearchText)
            }
        ).value;
        AccountEnabled = true;
        Not("#EXT#" in UserPrincipalName);
        Not("Test" in DisplayName)
    )
     
    And here's the button OnSelect property:
     
    Patch(
        '📝 FUP - 2.2';
        GalleryBU.Selected;
        {
            Title: "";
            History_PendingTasks: ("(" & Now() & ") " & User().FullName & ": " & RichTextEditor1.HtmlText & Char(13) & GalleryBU.Selected.History_PendingTasks);
            Task_responsible: ForAll(
                CB_TaskHolders.SelectedItems As aPerson;
                {
                    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
                    Claims: "i:0#.f|membership|" & Lower(aPerson.Mail);
                    Department: "";
                    DisplayName: aPerson.DisplayName;
                    Email: aPerson.Mail;
                    JobTitle: "";
                    Picture: ""
                }
            )
        }
    )


    Coded as it is, there are no error flags, but whenever I try to test it out, an error saying "The requested operation is not valid" appears
  • WarrenBelz Profile Picture
    WarrenBelz 145,666 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 145,666 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    Same code
    Patch(
       DataSource,
       LookUp(
          Datasource,
          . . . . . .
       ),
       {
          PersonFieldName:
          ForAll(
             ComboBoxName.SelectedItems As _Items,
             {
                Claims: "i:0#.f|membership|: & Lower(_Items.Mail),
                Department: "",
                DisplayName: _Items.DisplayName,
                Email: _Items.Mail,
                JobTitle: "",
                Picture: ""
             }
          )
       }
    )

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • DC-18082037-0 Profile Picture
    DC-18082037-0 37 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    Thank you for taking the time Warren.  How does one PATCH this field
  • WarrenBelz Profile Picture
    WarrenBelz 145,666 on at
    Use Office365Users.SearchUserV2() with a multi-selct people picker
    The main issue here is that the Office365.SearchUser function returns a slightly different schema to the Person field, so the Update of the Data Card would be
    ForAll(
       ComboBoxName.SelectedItems As _Items,
       {
          Claims: "i:0#.f|membership|: & Lower(_Items.Mail),
          Department: "",
          DisplayName: _Items.DisplayName,
          Email: _Items.Mail,
          JobTitle: "",
          Picture: ""
       }
    )
    Then the DefaultSelectedItems of the Combo Box
    ForAll(
       ThisItem.YourPersonFieldName As _Items,
       {
          DisplayName: _Items.DisplayName,
          Mail: _Items.Email
       }
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard