The admin can search for people using two functionalities:
- Microsoft Graph
- SharePoint Search
Filtering disabled user accounts
The admin can now filter the disabled user accounts from the Azure Active Directory.
Microsoft Graph filtering
For filtering out the disabled user accounts from the Microsoft Graph people search, the admin needs to alter the Hub Config JSON file:
"id": "search_GraphUsers"in the Hub Config JSON file.
- Go inside the "dataProvider" block.
- In case you want to include the disabled accounts in the search results, then add "includeDisabledAccounts" :true inside the "dataProvider" block.
- In case you want to exclude the disabled accounts from the search results, then add "includeDisabledAccounts":false inside the "dataProvider" block or do not add this line at all.
Sharepoint Search filtering
At the moment this can only be done manually, as SharePoint Online and Azure Active Directory Online do not provide a proper automated way of mapping properties from Azure Active Directory user profiles to SharePoint Online user profiles. Please follow the steps below:
- Go to SharePoint Admin -> More Features -> Users -> Manage User Properties -> New Property.
- Create a new boolean property with the name of "DisabledAccount" / a suggestive name for disabled user accounts.
- When creating the property check the "Indexed" checkbox (by doing this, the property will be crawled automatically).
- In order for the property to be crawled, make sure you mark at least one user profile with this new property.
- After the crawling process, go to the managed properties from the Search Schema:
- Go to SharePoint Admin -> More Features -> Search -> Manage Search Schema -> Managed Properties -> New Managed Property.
- Create a new managed property with the type of "Yes/No". Mark it as "Searchable", "Queryable" and "Retrievable". In the creation process, map it to the previously created user profile property.
- After crawling, in the crawled properties there should be a property called "People:NAME_OF_YOUR_MANAGED_PROPERTY".
- Hover over it and click on the arrow. Select "Edit/Map property".
- Add a mapping to the newly created managed property.
- Go to the newly created managed property and add a mapping to the newly created crawled property.
- Open the Hub Config JSON file, and search for "id": "search_People".
- Inside the "dataProvider" block, look for the "queryTemplate" block.
- Inside the "queryTemplate" block add "contentclass:"urn:content-class:SPSPeople" AND NOT "DisabledAccount":0".
- IMPORTANT: the name "DisabledAccount" is just an example, use the name of the property that you created.
- To test this functionality go to the global search and select the PEOPLE tab and in the search box type
*in order to get all the user profiles. The results should not include the accounts that the user has marked as disabled.