This is another issue from the trenches as I was working with a client of mine recently with a disconnect between the SharePoint User Profile Service and Search.

Custom User Profile Property Not Showing as Crawled Property in Search

The fix is surprisingly simple, and you will face palm once you realize what the cause is but I thought it was important to document for others.

The Requirement

Like a lot of organizations, one of my clients has a robust search-based Staff Directory (they are using SharePoint Online in Office 365).  They sync from a local AD and push to Online via the standard dirsync.  They came to me and gave me a new requirement – we need to remove certain contractor and vendor accounts from showing up.

“That makes sense, I’m glad to help.”

The Issue

Filter on the OU

The users to exclude weren’t denoted as a vendor or contractor account via any property that I could key off of (e.g. where Job Title = Contractor). 

However, all of the users were located in the same OU in the local AD, so maybe I could use the OU path.  If we look at the Distinguished Name user profile property in Online, what do we find?  For a user it looks like this:

CN=6d7b0213-f5fc-4375-8417-466e806316b1,OU=228e4d92-01f0-4378-a468-d14fe54de509,OU=Tenants,OU=MSOnline,DC=SPODS1367740882,DC=msoprd,DC=msft,DC=net

Not very helpful!  In Azure Active Directory, all your users in your tenant are put in one single OU.  You can create different OUs, but it’s weird and just not the right fix for us here.

Use a Custom Property

Instead, I created a custom user profile property called “Exclude from Staff Directory” of type boolean (Yes/No). 

SharePoint Online Custom User Profile Property

I went and checked the box on the profiles for the small numbers of users that fell into this category, and waited.  And waited, and waited. 

After 48 hours there was still no crawled property existing that I could map a managed property to in search.  Houston we have a problem!  You have to wait for a full search crawl to run to pick up this new property, and have users with this property to get back for it.  This is SharePoint Online, and that generally happens in 24 hours.

The Fix

We found out the problem was due to a simple oversight on my part.  If you look at the settings of your custom user property, review the Privacy settings.

SharePoint Custom User Property Privacy Setting

This was set to Only Me.  It turns out that you think this might not matter, it does.  It needs to be set to Everyone.  Once another 24 hours wait and full search crawl happened, I got my crawled property to show like I wanted. 

SharePoint Custom Search Crawled Property

Now I can map that to a search managed property, and add that to my search based Staff Directory to get them excluded. 

It’s always turns out that the smallest things cause big issues!

Please contact us if you need assistance with implementing your own Staff Directory or even SharePoint!