Monday, January 9, 2017

Property Promotion and Demotion in SharePoint

Once I experienced a peculiar  behaviour in the search functionality in one of the SharePoint environments. The task was to simply move a bunch of office documents in a SharePoint 2010 farm to a SharePoint 2013 farm. Yes, it was a document migration. The document metadata was scheduled to be updated in the new document library based on data in a CSV file. Had to do some digging and troubleshoot the issue.

The documents downloaded from SP 2010 web site had the metadata embedded within the document properties. The SP 2013 site had the "parserenabled" property set to true.

This has caused the metadata embedded within the documents to be Promoted to the site. That resulted in causing inconsistencies in the Search results.

So whats Property promotion and demotion? Property promotion refers to the process of extracting values from properties of a document and writing those values to corresponding columns on the list or document library where the document is stored. Property demotion is the same process in reverse.

So in my case, what happened was, the documents properties had been automatically promoted to SharePoint. When the document was added to the document library, the Document Parser extracts document property values and writes to a Property Bag (to an instance of the IParserPropertyBag Interface). And then SharePoint reads the properties from the Property Bag and promotes the applicable property values to the library based on Document Content Type or the Library Schema.








When the "parserenabled"  property is set to true in a site, SharePoint automatically captures the properties set within the office document and Promotes them.

Properties are only promoted or demoted if they match the list's columns that apply to the document.

If you need to disable document parser and stop this behaviour you could do that with a simple PowerShell script

$site = new-object microsoft.sharepoint.spsite("http://mySharePointSite.com/SubSite")
$web = $site.openweb()
$web.parserenabled = $true
$web.update()

If you don't need the Promoted properties to be available in the Search results, you could do that as well. Go to Search Service Application via the SharePoint Central Administration. Go to "Search Schema". Select the Managed Property where the document's Parsed property is set as a Mapped Crawled property. Remove the mapping with the Parsed Property.

2 comments: