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 / Office365Users.SearchU...
Power Apps
Answered

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
    Microsoft Employee 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
    Microsoft Employee 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard