SharePoint allows you to store ad-hoc values in property bags values on SPWeb objects in server-side code. You can even setup SharePoint search to crawl these properties using the server-side SPWeb.IndexedPropertyKeys property – just add the name of the property bag key to the list of IndexedPropertyKeys and the next time the crawler hits the web it will create a crawled property with the property bag value.
But what about O365? You can only use CSOM against O365 and there is no CSOM equivalent to the IndexedPropertyKeys property that lets you define which property bag values to index. Fortunately, Vesa Juvonen took the time to decompile the code behind the IndexedPropertyKeys value and basically found that it contains a pipe-delimited, Base64 encoded list of the property keys to index. You can find the code for this approach here.
One of the questions that was left unanswered, however, is whether this approach works on O365. I went ahead and tried this out on my O365 site and I can confirm that it works in O365, at least for the time being. You will have to wait for the search crawler to run again, so don’t lose hope that it’s not working if you don’t see it show up in search results right away.
Load comments