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 / Help with Office365Use...
Power Apps
Answered

Help with Office365Users.SearchUserV2 - Multiple searchTerms? Show only specific CompanyName value?

(0) ShareShare
ReportReport
Posted on by 112

I have a canvas app with a Gallery control.  Above the Gallery control is a TextInput box (TextInput1).  

 

Names entered into the TextInput box show the search results in the gallery.  Currently I am using this formula:

 

Office365Users.SearchUserV2({searchTerm:TextInput1.Text,top:10}).value

 

Now I would like to narrow down the search results by showing only users where CompanyName is "My Company Name". CompanyName is another attribute from the Office365Users connector. I don't want this to be shown on the form but hardcoded in the formula. 

 

Can I add another searchTerm like CompanyName="My Company Name" into the formula above? What's the best way to do this?

 

Thanks!

Categories:
I have the same question (0)
  • Verified answer
    bapala Profile Picture
    247 on at

    Hi @greddin,

     

    At this moment, there is no way to search users by CompanyName. SerachUser(V2) only works with following user information:
    display name, given name, surname, mail, mail nickname and user principal name.

    See more info here: SearchUser(V2) 

    But, in other hand you can filter the data by 'logged in user' company name. You can try something like below:
    OnStart property of the App:
    Set(userCompanyName,Office365Users.UserProfileV2(User().Email).companyName)

    Items property of the Office365Users:
    Filter(Office365Users.SearchUserV2({searchTerm:TextInput1.Text}).value, userCompanyName)

    Hope this helps...!

  • mariagiugno Profile Picture
    23 on at

    Hi @bapala ,

    Do you know if this is still true regarding SearchUser(V2) limitations?

     

    I am trying to accomplish something similar on a combo box. I want it to show only the email addresses that are a part of My Company Name in this combo box.

     

     

    Distinct(Filter(Office365Users.SearchUser({searchTerm: CompanyId.SearchText}),CompanyName="MyCompanyName"),Mail)

     

     

    OR

     

     

    Distinct(Filter(Office365Users.SearchUserV2({searchTerm:CompanyId.SearchText}),Mail),
    
    AccountEnabled, CompanyName = "MyCompanyName")
    
    

     

    If anyone could assist me with this I would greatly appreciate your time!

     

    Thank you,

    Maria 

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard