Forum Discussion
People search results excluding external/guest users
I would like to exclude/hide external/guest users in the people search in our SharePoint intranet site. In SharePoint admin centre created a new search "local people search2" which excludes external users using -AccountName:"#ext#" in the query text box, but it is not saved
Than in the "People-Directory.aspx" and "peopleresults.aspx" pages, I have edited the pages and webpart section and changed the query using "change query" section where I changed from the default "local people search" to "local people search2" see below. I saved and published the changes but it keeps defaulting back to "local people search" instead on "local people search2", where am I going wrong, why does it keep defaulting back? When I test the query in the edit webpart it does what I need it to do, but it does not save the change from "local people search" to "local people search2" in the select query section - I have also tried saving -AccountName:"#ext#" in the query text box which did not work either
3 Replies
Hello john_west3
use the PnP Modern Search WebParts for modern Search in M365 https://microsoft-search.github.io/pnp-modern-search/scenarios/Create-a-useful-People-Search/
You don't need a specific result source, you can exclude the external users direct in your query.
Best, Dave
- john_west3Copper Contributor
Thank you, do you know how to set the filtering to use the "company" field which is in Active directory? I cannot find it in the fields section, but we use it in our AD to list which division the staff are in? I have been able to use the department, keywords and job-title fields to filter but would also like to be able to filter by "company" too?
Thanks for your help
- john_west3Copper ContributorThank you, its a shame I could not work out how to resolve current method.. but will look into this way