Inconvenient Managed Properties and getting a list of all custom Managed Properties in SharePoint 2013
When working with search-driven solutions there are scenarios that require creating custom Managed Properties. Unfortunately SharePoint doesn’t offer an easy way of keeping track of those custom Managed Properties. Find out how to get a list of all custom Managed Properties.
SharePoint 2013 Search – more than just search
With the release of SharePoint 2013, Search became more than a search box and a results page that you use when you’re looking for something. Thanks to its new content publishing capabilities, SharePoint 2013 Search can now also be used to discover and aggregate content no matter where it’s stored. As a result more and more solutions leverage Search to query for and present content to users.
One of the dependencies of search-driven solutions are Managed Properties that contain the metadata of content crawled by SharePoint 2013 Search. As new metadata are defined in the content crawled by SharePoint, new Managed Properties are created. Assuming that your custom metadata are created as Site Columns and there is some content stored in those columns, SharePoint will automatically create Managed Properties for those columns and you will be able to use them in your solution without any manual effort.
Inconvenient Managed Properties
In some scenarios, despite of SharePoint creating Managed Properties for you, you might want to create some additional Managed Properties yourself. One of the most common examples is the need for a sortable DateTime Managed Property. If you have a Site Column of type DateTime, when crawling your content, SharePoint will automatically create a Managed Property mapped to your Site Column. Unfortunately this Managed Property will be of type Text.
As an alternative you might consider mapping the Crawled Property created for your Site Column to one of the standard available RefinableDate properties.
The problem with this approach is, that even though the data type listed in Central Administration is Date and Time, as soon as you start using one of those properties you will see some unexpected behavior. If you look closely at the real data type returned by those properties you will see that it’s actually string rather than DateTime.
And so you will end up creating your own Managed Properties.
Inconvenient managing Managed Properties
Creating Managed Properties isn’t difficult. The real challenge is to keep track of all custom Managed Properties. Although SharePoint 2013 allows you to export search configuration, it only allows you to do so on the Site Collection level. Unfortunately, as you can only create Managed Properties of types Text and Yes/No at the Site Collection level, you will find yourself creating custom Managed Properties in Central Administration where there is no easy way for you to see which of the few hundreds Managed Properties belong to SharePoint and which are custom.
Getting an overview of all custom Managed Properties
If you have access to PowerShell, you can easily get a list of all custom Managed Properties using the following snippet:
$ssa = Get-SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $ssa | ? { $_.SystemDefined -eq $false } | ft Name
One thing worth mentioning is, that the list that this script produces, contains both Managed Properties created manually and Managed Properties created automatically for your custom Site Columns during a Full Crawl.
Tip: One way that could help you distinct Managed Properties created automatically from the ones created manually is that Managed Properties created automatically always follow the naming convention MyPropertyOWSXXXX where XXXX is the four-letter code describing the data type, ie. DATE, HTML, TEXT, etc., or owstaxidMyProperty for Managed Properties created for Managed Metadata Fields.
Despite this slight disadvantage, using this script will allow you to narrow the list of Managed Properties to a few dozens making it easier for you to keep track of your Managed Properties.
Summary
When working with search-driven solutions in SharePoint 2013 there are scenarios that require creating custom Managed Properties. Unfortunately SharePoint doesn’t offer an easy way of keeping track of those custom Managed Properties. Using PowerShell you can easily get an overview of all custom Managed Properties created in your Farm.