cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Capt_Ron
Level: Powered On

Scope Office365Users.SearchUser() to subset of people

We have 3 categories of people in our Office 365.  Students, Employees, Contractors.

They all have different email address domains and are separated in Azure AD by OU.

 

How can I have the Office365Users.SearchUser only pick from the Employees?

 

Assume:

Email domains

Employees - @company.com

Students - @Stu.company.com

Contractors - @vend.company.com

 

OUs:

Employees - OU=Employees,DC=Company,DC=com

Students - OU=Students,DC=Company,DC=com

Contractors - OU=Contractors,DC=Company,DC=com

 

Thank you

Ron

1 ACCEPTED SOLUTION

Accepted Solutions
Capt_Ron
Level: Powered On

Re: Scope Office365Users.SearchUser() to subset of people

I was playing around with something similar to that and came up with this:

 

If(!IsEmpty(SearchUser), Sort(Filter(Office365Users.SearchUser({searchTerm:First(SearchUser).Value}), Len(GivenName) > 0 && CompanyName = "EMP"), GivenName, Ascending))

 

I realized that I can use other attributes too.  CompanyName is also a way to distinguish between the 3.

 

Thank you.

View solution in original post

4 REPLIES 4
Microsoft Employee

Re: Scope Office365Users.SearchUser() to subset of people

I would try something like this:

 

Gallery1.Items=Filter(Office365Users.SearchUser(), Left(Mail, 😎 = "@company")

Microsoft Employee

Re: Scope Office365Users.SearchUser() to subset of people

 
Capt_Ron
Level: Powered On

Re: Scope Office365Users.SearchUser() to subset of people

I was playing around with something similar to that and came up with this:

 

If(!IsEmpty(SearchUser), Sort(Filter(Office365Users.SearchUser({searchTerm:First(SearchUser).Value}), Len(GivenName) > 0 && CompanyName = "EMP"), GivenName, Ascending))

 

I realized that I can use other attributes too.  CompanyName is also a way to distinguish between the 3.

 

Thank you.

View solution in original post

Highlighted
Mikkola
Level: Powered On

Re: Scope Office365Users.SearchUser() to subset of people

Hey,

i had the same challenge and couldnt use the companyname as a way to distinguish them.

Kinda got it to work with this:

If(!IsBlank(Trim(TextSearchBox1.Text)); Filter(O365Users.SearchUser({searchTerm: Trim(TextSearchBox1.Text); top: 15});"@company.com" in Mail))

 

Im new to powerapps, so id appreciate if anyone would point out if this way of doing it causes problems or if it is a working solution. If it works, maybe it will help next person looking for the same answer. 

 

p.s. I used the ready-made email screen layout and just added the filter. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 213 members 5,231 guests
Please welcome our newest community members: