SharePoint Document Property Promotion and Demotion

This SharePoint tutorial explains document property promotion and demotion in SharePoint. Here we will also see, how to disable document property promotion using PowerShell and SharePoint server object model code.

The document property promotion and demotion will work in SharePoint Online or SharePoint 2010/2013/2016. But we can enable to disable property promotion in SharePoint On-premises versions only.

SharePoint Document Property Promotion

SharePoint document property promotion refers to the process of extracting values from properties of a document and writing those values to corresponding columns on the SharePoint list or document library where the document is stored.

SharePoint Document Property Demotion

SharePoint document property demotion is the process of reading list columns and writes to document properties.

To check how it works, follow the below steps:

Upload a document to a document library and set up metadata for the document. For example, I have an upload an excel document to a document library and set up metadata like below:

SharePoint Document Property Promotion
SharePoint Document Property Promotion

Once you set up the document metadata, download the document and you can rename the document or modify the document content and upload the document (Make sure the rename the document to a different name, because you can not upload a document with the same name to a document library).

Now, you will see the Department column value will be populated with value as “Training” by default like below:

SharePoint Document Property Demotion
SharePoint Document Property Promotion and demotion

But sometimes clients do not want to set default values like the above. The requirement might be to treat like a brand new document without setting up any properties, in those cases we can disable document property promotion.

We can enable or disable property promotion and demotion by using the Server object model code as well as by using PowerShell in SharePoint 2010/2013/2016.

We can disable or enable property promotion in SharePoint Online. It will work only for SharePoint onpremise versions.

Enable or disable document property promotion using PowerShell

We can easily enable or disable document property promotion using PowerShell in SharePoint 2013/2016. You can execute the PowerShell script in Windows PowerShell ISE.

Enable document property promotion using PowerShell

Below is the PowerShell script to enable document property promotion in SharePoint 2010/2013/2016.

Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb "http://mypc/sites/MySP2016SiteCollection/"
$web.ParserEnabled = $true
$web.Update()
$web.Dispose()

Disable document property promotion using PowerShell

Below is the PowerShell script to disable document property promotion in SharePoint 2010/2013/2016.

Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb "http://mypc/sites/MySP2016SiteCollection/"
$web.ParserEnabled = $false
$web.Update()
$web.Dispose()

Enable or disable document property promotion programmatically using SharePoint Server Object Model

Apart from PowerShell, we can also enable or disable document property promotion programmatically using the SharePoint server object model code.

Enable document property promotion programmatically

Below is the SharePoint server object model code to enable document property promotion programmatically in SharePoint 2013/2016/2010.

using (var site = new SPSite("http://mypc/sites/MySP2016SiteCollection/"))
            {
                using (var web = site.OpenWeb())
                {                   
                    web.ParserEnabled = true;
                    web.Update();                   
                }
            }

Disable document property promotion programmatically

Below is the SharePoint server object model code to disable document property promotion programmatically in SharePoint 2013/2016/2010.

using (var site = new SPSite("http://mypc/sites/MySP2016SiteCollection/"))
            {
                using (var web = site.OpenWeb())
                {                   
                    web.ParserEnabled = false;
                    web.Update();                   
                }
            }

You may also like following SharePoint tutorials:

In this SharePoint tutorial we learn:

What is document property promotion in SharePoint? How to enable or disable document property promotion in SharePoint 2010/2013/2016 using PowerShell and using the SharePoint server object model code.

>