cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
therush321
Helper II
Helper II

Filter 0365 users to a select few for a people list

Hi

I am trying to filter down my O365 list of users for a select few for everyone to select. I managed to it working for one user but not multiple.

 

 

Office365Users.SearchUser({searchTerm: "John Cena"}).DisplayName

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
therush321
Helper II
Helper II

I managed to resolve this with the following code in my Items section:

Filter(Office365Users.SearchUser({top:999});
Mail = "test1@abc.co.za"
Or Mail =  "test2@abc.co.za"

Or Mail =   "test3@abc.co.za")

View solution in original post

7 REPLIES 7
eka24
Super User
Super User

Have you tried just:

Office365Users.SearchUser({searchTerm: ""}).DisplayName

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24  Thank you but that does not resolve my issue.

I wanting to filter O365 to a few names or emails. So I would like to limit what a user selects based on my filtering.

eka24
Super User
Super User

Create a collection OnStart or Onselect of a button:

ClearCollect(MyUsers,Office365Users.SearchUser({searchTerm:""}).DisplayName)

 

Then Filter as follows:

Filter(MyUsers, DisplayName in ["John Cena", "abc","SSAh"])

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@therush321 

You can specify as many people you want by their emails.  Load them into a collection like this.  Add more if you like.  Don't use the search method.  Use UserProfileV2 instead.

ClearCollect(colPeople,
    Office365Users.UserProfileV2("jcena@yourcompany.com"),
    Office365Users.UserProfileV2("kcena@yourcompany.com"),
    Office365Users.UserProfileV2("lcena@yourcompany.com"))
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Thank you very much but it is not populating anything at all.

I added the code OnStart: 

 

 

ClearCollect(MyUsers;Office365Users.SearchUser({searchTerm:""}).DisplayName)

 

 Then for the items:

 

Filter(MyUsers, DisplayName in ["John Cena", "Tester 123"])

 


It does not populate any names. Any idea on getting this working @eka24 ?

@mdevaney  Thank you but a bit lost on the next steps.

I added the code to OnStart then what should my code look like for my Items?

therush321
Helper II
Helper II

I managed to resolve this with the following code in my Items section:

Filter(Office365Users.SearchUser({top:999});
Mail = "test1@abc.co.za"
Or Mail =  "test2@abc.co.za"

Or Mail =   "test3@abc.co.za")

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,614)