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
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 (4,507)