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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Office365Users.SearchU...
Power Apps
Unanswered

Office365Users.SearchUser field to search in?

(0) ShareShare
ReportReport
Posted on by 61

Hello,

 

I have simple gallery people picker, this is in the gallery item property:

 

Office365Users.SearchUser({searchTerm: TextInput1.Text})

 

 

Is there way to select which field is searched (like email or displayname)? You can do this with combobox but I cannot figure it out with gallery. I have tried Office365Users.SearchUser({searchTerm: TextInput1.Text}).DisplayName for example but that did not work.

 

Thank you in advance.

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @Kubo :

    Do you want to filter on the "email" field or the "displayname" field based on the user's choice?

    If so,please try:

    1\Add a Radio control(Radio1) and set it's items property to 

    ["Email","Displayname"]

    2\Set the Gallery's items property to:

    With(
     {UserList: Office365Users.SearchUser({top:999})},
     Switch(
     Radio1.Selected.Value,
     "Email",
     Filter(
     UserList,
     TextInput1.Text in Mail
     ),
     "Displayname",
     Filter(
     UserList,
     TextInput1.Text in DisplayName
     )
     )
    )

    Best Regards,

    Bof

     

     

  • Kubo Profile Picture
    61 on at

    Thank you very much for your reply. I have tested it and it did not work for me although no errors were shown. There is probably to many users to search this way. I know there is some limit to search user function, this return results:

    Office365Users.SearchUser({searchTerm: TextInput1.Text})

     this does not return results:

    Office365Users.SearchUser({searchTerm: TextInput1.Text in Mail})

     

    In Combobox you can select search field, would there be any way to select the search field in the Gallery? 

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Kubo :

    The second formula you provided has a syntax error, SearchUser does not allow you to search in this way.

    If you need to user gallery to select the search field,please try:

    1\Add a Gallery control(Gallery1) and set it's items property to 

    ["Email","Displayname"]

    2\Add an other gallery and set it's items property to:

    With(
     {UserList: Office365Users.SearchUser({searchTerm:TextInput1.Text,top:999})},
     Switch(
     Gallery1.Selected.Value,
     "Email",
     Filter(
     UserList,
     TextInput1.Text in Mail
     ),
     "Displayname",
     Filter(
     UserList,
     TextInput1.Text in DisplayName
     )
     )
    )

    002.gif

    Best Regards,

    Bof

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard