cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Filter people picker list

Hi,

I have a people picker field on my form currently it shows all users in my domain.  I only want to show some of the users listed not all.  The users have different email one is @company.au and the other is @guestcompany.au.  Is there a way to stop @guestcompany.au from appearing in the people picker list when a user is typing a name into the search field?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Grichardson,

Could you please share a bit more about the formula you typed within the Items property of the People Picker Combo Box control? Is it "Choices('YourSPList'.YourPersonColumn)"?

Could you please share a bit more about your data source? Is it a SP list?

I assume that your data source is a SP list, and there is a Person type column within it, is it true?

I have made a test on my side, if you want to filter your People Picker Combo Box directly within your Edit form, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, please take a try with the following workaround:6.JPG

Firstly, you need to add a Office 365 Users connector within your app.

Set the Items property of the Combo Box within the People field Data card to following:

Filter(Office365Users.SearchUser({searchTerm: DataCardValue8.SearchText}), "Test" in Mail) /* <-- DataCardValue8 represents the Combo Box within my People field Data card in my Edit form */

On your side, you should type:

Filter(Office365Users.SearchUser({searchTerm: PeoplePickerComboBox.SearchText}), Not("@guestcompany.au" in Mail)) /* <-- PeoplePickerComboBox represents the Combo Box control within your People field Data card in your Edit form */

then re-configure the Primary text, Secondary text and SearchField property of the People Picker Combo Box as above screenshot.

Set the IsSearchable property of the Combo Box to following:

true

Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/People-Picker-filter/td-p/102675

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Kudo Kingpin
Kudo Kingpin

@Grichardson you need to use Filter function with Contains function in its expression.

Anonymous
Not applicable

Filter(PeoplePickerSource, !("@guestcompany.au" in FieldWithMailAddress))

Hi Cvdk

I was trying something like you have suggested, but I am not sure what ‘FieldWithMailAddress’ should be. My understanding is the list of users is from AD. I am unsure how to single out the email address from the information I am pulling from AD.
Anonymous
Not applicable

How (with what code) are you currently populating your list of users (before filtering)?

Community Support
Community Support

Hi @Grichardson,

Could you please share a bit more about the formula you typed within the Items property of the People Picker Combo Box control? Is it "Choices('YourSPList'.YourPersonColumn)"?

Could you please share a bit more about your data source? Is it a SP list?

I assume that your data source is a SP list, and there is a Person type column within it, is it true?

I have made a test on my side, if you want to filter your People Picker Combo Box directly within your Edit form, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, please take a try with the following workaround:6.JPG

Firstly, you need to add a Office 365 Users connector within your app.

Set the Items property of the Combo Box within the People field Data card to following:

Filter(Office365Users.SearchUser({searchTerm: DataCardValue8.SearchText}), "Test" in Mail) /* <-- DataCardValue8 represents the Combo Box within my People field Data card in my Edit form */

On your side, you should type:

Filter(Office365Users.SearchUser({searchTerm: PeoplePickerComboBox.SearchText}), Not("@guestcompany.au" in Mail)) /* <-- PeoplePickerComboBox represents the Combo Box control within your People field Data card in your Edit form */

then re-configure the Primary text, Secondary text and SearchField property of the People Picker Combo Box as above screenshot.

Set the IsSearchable property of the Combo Box to following:

true

Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/People-Picker-filter/td-p/102675

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Hi @Grichardson,

 

If in PowerApps Studio you add an New Screen and select the screen type 'Email', it has a great example of a way to pick people from your Azure AD domain based on the Office365Users connector.

It contains a galley called 'PeopleBrowseGallery1' this has the following formula:

 

If(!IsBlank(Trim(TextSearchBox1.Text)), Office365Users.SearchUser({searchTerm: Trim(TextSearchBox1.Text), top: 15}))

 

If you change this to the following, it will find the first 15 users based on the searchterm that was entered into TextSearchBox1, but only if the user does not have "@guestcompany.au" in it's mailadres.

 

If(!IsBlank(Trim(TextSearchBox1.Text)),Filter(Office365Users.SearchUser({searchTerm: Trim(TextSearchBox1.Text), top: 15}),!("@guestcompany.au" in Mail)))

 

You can increase the number of users it returns by changing the value for "top:", but not higher than 999. At least for me it failed returning anything if set to 1000 or above.

 

Hope this helps.

Kr,

Casper

@v-xida-msft  HI, how does one add multiple emails to be added to be searched?

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (42,086)