Created
March 31, 2016 05:12
-
-
Save sksnips/670bfa501ffbb27a86e4c86285819ada to your computer and use it in GitHub Desktop.
This JSOM code snippet removes the owners/members permissions to customize the pages in advanced mode in the current Site Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Author: Shantha Kumar T | |
//Property used: SP.Site.allowRevertFromTemplate (sp.js) | |
//Supports SharePoint 2010 + and SharePoint Online | |
function disablePageCustomizationAccess() { | |
var clientContext = new SP.ClientContext(); | |
oSite = clientContext.get_site(); | |
//The below line helps to disables the page customization access | |
oSite.set_allowRevertFromTemplate(flase); | |
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() { | |
disablePageCustomizationAccess(); | |
} | |
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment