Monday, 24 March 2014

How to programmatically determine customized pages in a site in SharePoint 2013


What happens when the need is to determine programmatically that a given page has been customized/ghosted or not?

We can use the "vti_hasdefaultcontent" property of the "SPFile" class to determine whether a file is customized or native.

SPFile file = SPContext.Current.Web.RootFolder.Files["default.aspx"]; 

bool IsCustomized = (bool) file.Properties["vti_hasdefaultcontent"];

No comments:

Post a Comment