This post has been republished via RSS; it originally appeared at: SharePoint Support Blog articles.
In the post Exclude Users From Delve and SharePoint Online we address one way to remove user profiles from being returned when searching in SharePoint or Delve. --This is done by setting the AD property msExchHideFromAddressLists to true, and is mapped to the managed property SPS-HideFromAddressLists.
This method of hiding user profiles is useful, but there are easier ways to hide types of profiles rather than having to set msExchHideFromAddressLists individually. In this post we will look at other properties that can be used to hide profiles from search results.
Note: The properties and exclusions discussed below are already taken into account in Delve and the modern search experience. If you use the classic search center or have built a custom search experience you should consider making use of these properties in additon to SPS-HideFromAddressLists.
The managed property SPS-UserType defines whether a profile is for an internal user or a guest user. If you want to exclude guest profiles from search results, you can add to a query SPS-UserType:0. Conversely, to only return guest profiles, use SPS-UserType:1.
The other useful property is SPS-ReceipientTypeDetails which is mapped to MsExchangeRecipientTypeDetails. In our modern experiences we filter out the following values: 4 (SharedMailbox), 16 (RoomMailbox), 32 (EquipmentMailbox), 8589934592 (RemoteRoomMailbox), 17179869184 (RemoteEquipmentMailbox), 34359738368 (RemoteSharedMailbox), and 2199023255552 (LinkedRoomMailbox)
To use all of these properties, you need to create a new result source to replace Local People Results with the query transform set as such:
{?{searchTerms} (-"sps-usertype":1 AND -"sps-hidefromaddresslists":1 AND -"sps-recipienttypedetails"=4 AND -"sps-recipienttypedetails"=16 AND -"sps-recipienttypedetails"=32 AND -"sps-recipienttypedetails"=8589934592 AND -"sps-recipienttypedetails"=17179869184 AND -"sps-recipienttypedetails"=34359738368 AND -"sps-recipienttypedetails"=2199023255552) ContentClass=urn:content-class:SPSPeople}
This is an easy way to help improve the people search experience for your users.