cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
greddin
Helper I
Helper I

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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
bapala
Resolver III
Resolver III

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...!

View solution in original post

1 REPLY 1
bapala
Resolver III
Resolver III

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...!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,386)