Friday, January 23, 2015

Hide content from Delve–but not from search

[Update 2015-05-01]
Microsoft have now updated the documentation at Manage the search schema in SharePoint Online, and you no longer have to create a managed property or map the crawled property to it. The only step you have to perform to hide data from Delve is to create a site column named HideFromDelve of type Yes/No, and start using it. Everything else is taken care of for you by Microsoft :)

Remember that this will only hide the content from the Delve application, not from the Office Graph and other apps built using it.

[Original Post]

I love Friday’s! Why? Because I get to spend time in the office not being out at a customer site. And when in the office, more often than not, conversations with my colleague Andreas Eide spawns an idea or a blog post. So here goes!

Andreas has this issue where he get’s a lot of invoices in his Delve board, which is not very interesting. They appear because people he collaborates with produce a lot of invoices. The first solution was to mark the invoice library not to be indexed. The drawback however is that this makes the invoices not discoverable at all via search, and you also have to exclude the full library, not just individual items or folders. So then what?

Read the official documentation

Turns out Microsoft solves this for us… or at least has rolled out a plan to solve it. Every now and then I fire up Fiddler to see what queries Delve does, and this is what it showed this morning.

Notice the highlighted area with (NOT HideFromDelve:True).

The query is using a managed property with the name HideFromDelve to filter away items you want to hide from the Delve dashboard. Also notice the syntax used. HideFromDelve:False would have shown all items explicitly set to false, while (NOT HideFromDelve:true) will show all items explicitly set to false AND all items missing a value for this managed property. It’s a very clever trick I often use in other search solutions. You also want to include everything which hasn't set a specific value.

I checked a few SPO tenants, and none of them have the managed property defined, but they all use it in the Delve queries. Good news is you can create it yourself from the search schema page in SPO. Make sure to mark is Queryable, if not it won’t work.


From the above image you see I have mapped the managed property to a crawled property of ows_HideFromDelve. This is just the convention we chose to use for columns/site columns in SharePoint where we want to opt-out of Delve.
To make it easy for you I have created a schema mapping file which creates the managed and crawled properties for you. Follow these steps:
  1. Download HideFromDelveConfiguration.xml from
  2. Navigate to">https://<tenantname>
  3. Click Import Search Configuration
  4. Choose the schema file you downloaded
  5. Click Import
The search part is now wired and ready to go. Next step is to prepare your content to make use of this configuration.

As the crawled property in the schema file is ows_HideFromDelve, you have to create a column with this same name (InternalName)

It’s probably smart to set the default value to No if you will start using this in base content types.

Once the column is created, we chose to use the approach of adding the column to the Document libraries we want excluded from Delve, and then set the default value for the column either on the full library, or on folders to No. The below image has HideFromDelve=false on the library and HideFromDelve=true on the invoice folder, making sure invoices are not surfaced on the Delve board (see setting column default values for a list/library on the settings page for the list/library).

The reason there are spaces in the Hide From Delve column above is that we renamed the HideFromDelve column after creation to ensure the internal name matched ows_HideFromDelve.

Once you modify your content to have this column set to False, go fetch a cup of brew, wait for the next crawl to pick up your changes, and the item should disappear from your Delve board!