Skip to content

Instantly share code, notes, and snippets.

@sksnips
Created March 31, 2016 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sksnips/4fcb6bb507ed78fe880cc1820333779a to your computer and use it in GitHub Desktop.
Save sksnips/4fcb6bb507ed78fe880cc1820333779a to your computer and use it in GitHub Desktop.
This JSOM code snippet identifies whether customizing the page in advanced mode is allowed on the current site collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowRevertFromTemplate (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function getPageCustomizationAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
//The below line get the boolean value of customizing pages is allowed on this site collection
if (oSite.get_allowRevertFromTemplate())
siteInfo = 'Advanced Customization of pages using SharePoint Designer : Allowed';
else
siteInfo = 'Advanced Customization of pages using SharePoint Designer: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
getPageCustomizationAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment