Restrict disabled users from showing up in SharePoint Online search results
An interesting ask came up the other day , “Is there a possibility to restrict disabled users from showing up in SharePoint Online search results” Thanks to our friend Sridhar Narra who shared some great insights to the solution. To achieve these we need to make few changes to On-Premise Active Directory.
1.Set msExchHideFromAddressLists property of the user that needs to be hidden from people search or Delve to True or 1.
2.Azure Active Directory Sync should synchronize the changes to Office365 directory services.
3.The change would eventually propagate all the way up to SharePoint Online (SPO)User Profiles.
4.Once changes are synched to User profiles, incremental crawl should crawl the profiles that were set with SPSHideFromAddressLists property.
5.To verify crawl has updated the index with the above changes, perform the steps below
Browse to search center in SharePoint Online and click on People search vertical. Type below query and you should see the result of the person that you intend to hide, example
https://contoso.sharepoint.com/search/Pages/peopleresults.aspx?k=manas%20biswas
To hide profiles with SPSHideFromAddressLists property updated in search index,example
https:// contoso.sharepoint.com/search/Pages/peopleresults.aspx?k=manas%20biswas%20-sps-hidefromaddresslists:1
6.Finally following steps allow default people search to exclude all profiles with SPS-HideFromAddressLists set.
- Browse to enterprise search people results page example https://contoso.sharepoint.com/search/Pages/peopleresults.aspx
- Edit Search Results page.
- Edit People Results Web part.
- Change query.
- Change Query Text from {searchboxquery} to {searchboxquery} –“SPS-HideFromAddressLists”:1
- Apply changes.
- Check-in changes and publish the page.
Now disabled users should no longer show up in search results.
Comments
- Anonymous
February 10, 2017
Hi, would something equivalent work on-premises?- Anonymous
February 14, 2017
Hi Len, it should work the same way on premises as all you are doing here is adding an additional restriction to the query for people to exclude those with this value.- Anonymous
April 04, 2017
On premises it would probably be better to make an exclusion filter (if you use FIM) like so:https://www.qdoscc.com/blog/sharepoint-tips-remove-disabled-user-profiles-search- Anonymous
April 24, 2017
Thanks for the suggestion Anders. Agreed depending on your import tech choice there are other ways to achieve this
- Anonymous
- Anonymous
- Anonymous