cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Grichardson
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
v-xida-msft
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

10 REPLIES 10
Mike_Guzowski
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)?

v-xida-msft
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?

Hi @v-xida-msft  I have implemented this solution but now when i submit the form data is not getting submitted to Sharepoint

Hi @vish3027 @Grichardson , I also the data is not submitting to SharePoint list. Could you please help me if you have a fix by now!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Top Solution Authors
Top Kudoed Authors
Users online (3,852)