Friday, November 23, 2012

Reset Customized Master Page to the Original Version (Ghosting) in SharePoint 2010

When we develop a custom master page and use a feature to deploy it in SharePoint, custom master page will be stored in %Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\<feature name> folder. Then when new sites are created and set our custom master page as the master page, SharePoint keeps a reference to the file located in 14 hive no matter how many sites are created. This process of all site collections and sites pointing to one file is called Ghosting.

But if the master page is customized in SharePoint Designer or uploads a new version in the master page gallery of a site, SharePoint stores a modified version of the master page in the content database (Unghosting or Customizing). This process basically breaks the reference SharePoint keeps to the master page file on the 14 hive. That is why we see a warning message in the first time we customize a master page in SharePoint Designer 2010, saying that we are about to customize a page and it will no longer be based on the site definition. The reason for this behavior is not to affect other SharePoint sites that are still using the original master page.


When there are custom controls or webparts embedded to the master page and if we try to change the master page in SharePoint Designer or uploads a new version of master page in the master page gallery, it will break the whole master page and the site in most of the time. In case if that happens, we need a way to revert back to the original master page. One option is to use SharePoint Designer to reset the master page to its site definition.

Navigate to the master page -> Right click -> Reset to Site Definition 


This brings our site back to its original state and at the same time, creates a copy of our customized master page and places it in the Master Page Gallery. 


Original master page is in the ‘Approved’ status and new copy is in ‘Draft’ status.