In support, we receive requests from time to time for information on how-to configure SharePoint People search and Delve results so that specific users do not appear in search results. Many admins want to be able to do this without having to delete or move users to a non-synced OU. The best way to accomplish this is to make the following changes: In your On-premises AD:
- Set the profiles AD property msExchHideFromAddressLists to True or Yes
- Run a Sync (DirSync etc) which will in turn be synced to SPO(If the change is made in Exchange Online, it will not be synced to SharePoint Online). Hint: You may need to add/update the “MailNickName” attribute in on-prem AD for the msExchHideFromAddressLists to sync.
- msExchHideFromAddressLists AD property contents are mapped to the UPA SPS-HideFromAddressLists
Note: Changing msExchHideFromAddressLists does not remove the user from the Organization view in Delve.
Once sync completes to UPA, there will be a profile incremental crawl that needs to complete so that the index has the managed property SPS-HideFromAddressLists. Delve automatically excludes or filter all profiles that have SPS-HideFromAddressLists managed property set to true so no additional changes/configurations need to be done for Delve. However, the SharePoint people search does not exclude these profiles automatically. The following configuration steps need to be performed to exclude these profiles from appearing in the SharePoint Online People search results:
- Go to enterprise search people results page: 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
NOTE: because of the dash in the managed property name, the managed property SPS-HideFromAddressLists needs to be enclosed in "" (make sure that you are using the correct "" and - otherwise your search results will be incorrect)
- Apply changes to the Search results Web Part
- Check-in changes to the Page
- Publish changes
NOTE: If you have any customization that use the Local People Results, similar changes needs to be implemented to automatically exclude all profiles configured -"SPS-HideFromAddressLists":1 to be excluded from there as well.
Remove the user from the Organization view in Delve:
- Find the user that you no longer want to show up in the Organization view in on-premises AD.
- Remove the manager value for the user. You will also need to update or change another synced field at the same time for the null value to be successfully synced. Examples of fields used include: 'MailNickName', 'Birthday', etc.
- Run a Sync.
Known limitations:
- This process does not work for cloud accounts.
- If you want the user to be returned in search you will need to change the msExchHideFromAddressLists value to false or no. If the value is only set to null in most cases it will not be synced down to SharePoint Profile and will continue to be removed from search.
- Changing msExchHideFromAddressLists does not remove the user from the Organization view in Delve.
Welcome to the SharePoint Blog! Learn best practices, news, and trends directly from the SharePoint team.