Searching Property Bags in SharePoint 2013

This is one of the 1001 or great new things about search in SharePoint 2013.  In fact if I had the copious free time that would actually be kind of a fun challenge, writing a 1001 new things I like about Search, but I digress.  In this particular case, I’m talking about adding properties to a property bag and getting them indexed and searchable.  Fortunately SharePoint 2013 makes this possible, not only for webs, but even all the way down to an SPList.  How cool is that? šŸ™‚

Here is some PowerShell you can use to get you started with creating an indexed property in an SPWeb property bag:

$web = Get-SPWeb http://localhost
$web.AllProperties[“Prop1”] = “value1”
$web.IndexedPropertyKeys.Add(“Prop1”)
$web.Update()

Next, here’s how you add an indexable property to a list:

$list = $web.Lists[“Announcements”]
$folder = $list.RootFolder
$folder.Properties[“Prop2”] = “Spammers”
$folder.Update()
$list.IndexedRootFolderPropertyKeys.Add(“Prop2”)
$list.Update()

Of course then just run a full crawl afterward to create the crawled property and all that hoo haw so you end up with a managed property when you’re done that is searchable, queryable and retrievable.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s