web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Passing a list into a ...
Power Apps
Unanswered

Passing a list into a people picker control

(1) ShareShare
ReportReport
Posted on by 32

Hello, I am using a people picker control which I would like to populate with existing email addresses taken from a text control on a form. I can pass one email address to the control and when invoked it will automatically display. Now I am trying to pass more than one address from a collection to the control and cannot seem to get the syntax correct. Am I barking up the right tree here?

 

 

 

 

Collect( PeopleSelected, Split( dcRequestorMail.Text, "; " ) ); ForAll( PeopleSelected, With( SearchPeople, LookUp( Office365Users.SearchUser({searchTerm: PeopleSelected, top: 100}), AccountEnabled = true ) ); If( Not(SearchPeople.UserPrincipalName in MyPeople.UserPrincipalName), Collect( MyPeople, SearchPeople ) ) )

 

 

 

My aim is to allow the user to amend or change the emails populated in the people picker and pass them back to the forms text control.

Categories:
I have the same question (0)
  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @LeonMc76,

     

    The approach looks good. Part of the code has this:

    {searchTerm: PeopleSelected, top: 100}

     

    However, that's referring to the name of the collection but we may need a value - for example, something similar to the following:

    {searchTerm: Email, top: 100}

     

    Also, bear in mind that there is also a new version of the search function, named SearchUserV2().


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • LeonMc76 Profile Picture
    32 on at

    Hello Keith,

    Thanks for replying. Substituting 'Value' for the collection name has sorted the syntax out in the code and it will run, however the picker control doesn't display anything. It's very frustrating. The V2 issue is next on my list. 😊

     

     

    Clear(PeopleSelected);
    Collect(
     PeopleSelected,
     Split(
     dcRequestorMail.Text,
     "; "
     )
    );
    ForAll(
     PeopleSelected,
     With(
     SearchPeople,
     LookUp(
     Office365Users.SearchUser({searchTerm: Value, top: 100}),
     AccountEnabled=true)
     );
     If(
     Not(SearchPeople.UserPrincipalName in MyPeople.UserPrincipalName),
     Collect(
     MyPeople,
     SearchPeople
     )
     )
    )

     

     

    EDIT: Weird. This code will accept one email address e.g. abc123@hotmail.com, and the people picker will display the profile, however as soon as you include more email in the string with the delimiter e.g. abc123@hotmail.com; abc456@hotmail.com; abc789@hotmail.com it glitches out.

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    My pleasure! Well done, that's a good step forward.

     

    If you select MyPeople in the formula bar to view the data it holds, can you see records as expected?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • LeonMc76 Profile Picture
    32 on at

    When there is one email address in the text box the code will pass it through, add it to the MyPeople collection and it does display the data in the formula bar, however when there is more than one email address with the delimiters it fails, doesn't pass anything through to the MyPeople collection and no data appears in the formula bar...? I'm baffled...

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Strange one. If you view the PeopleSelected collection, does that display records as expected?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • LeonMc76 Profile Picture
    32 on at

    Indeed it is and yes it does. The Collect and Split is working fine and the PeopleSelected collection is displaying its data as it should. 🤔 

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    To isolate if the issue is when the user is searched for, try running the following code manually (say, in App.OnStart) but hard-code the "Value" field to some of the users and confirm that results are being returned to the gblDebug variable:

    Set(gblDebug, Office365Users.SearchUser({searchTerm: "Value", top: 100})​);

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • LeonMc76 Profile Picture
    32 on at

    Confirmed that data is being passed to the gblDebug variable.

     

    Screenshot_code_1.png

     

    I'll try more than one address, hang fire. No I won't because it won't work.

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Great, that's confirmed then. For next steps, I suggest building up that manual "debug" code towards the full people picker control code step-by-step to see where the results show unexpectedly.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • LeonMc76 Profile Picture
    32 on at

    OK, will endeavour to get that done.

    Thanks Keith, appreciate your time.

    Will keep the thread updated with the process.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard