Forum Discussion
Apr 12, 2017
Can we search for only licensed users?
Here's the use case...
We've built an Employee Directory which uses Search to format the users nicely. It's based on my blog series here. Unfortunately, we see many users who are no longer at the company, service accounts, all sorts of "people" we don't want to see.
The query is pretty simple:
{searchboxquery} contentclass=spspeople
The company keeps users in Office 365 when they leave, but removes their licenses. Is there a way to augment the query to filter out unlicensed users?
Lacking this, how do others manage users in Office 365 to prevent searches from turning up ex-users?
Of course, I'm open to any other sugggestions as well.
Thanks,
M.
7 Replies
Sort By
It is possible to get the license status for a user in POSH (or custom code against Azure AD). I would use that to replicate the status into a user profile field and ensure that field is mapped to a managed property. From there, it is simply an update to the query you have above.
(I don't have easy access to the code, but I could get it if you need.)
- That's complicated!
The more I think about this, the more I believe there must be a better practice to follow, rather than Band-Aiding over things.- I would argue that License status is a poor attribute to use to indicate an employee has left the company. Perhaps the process improvement should happen within the company and not the software...
You may have to set or change some value of the user (office, phone, etc) and filter that out in your query string.
tk
How have you seen other people manage offboarding to handle this? Even if we put some specific value into a field to cover the Employee Directory use case, ex-users will still show up in people searches, etc.
M.
You could move ex employees to an OU that does not get replicated to Azure AD, assuming you have an onprem AD that you use, rather than all your users being only in AAD. I would think that you'd want to remove ex-employees from AAD. However, you need to put in place a policy and process for dealing with the OneDrive For Biz storage that they leave behind. Yes, their manager would get notified, but does the manager know what action to take to retain or toss the former employee's files?
https://support.microsoft.com/en-us/help/3042522/onedrive-for-business-retention-and-deletion
You also need to transition ownership of any Groups or Sites they were responsible for.