Created
March 28, 2016 03:57
-
-
Save sksnips/a97d688e08f3fc12795f to your computer and use it in GitHub Desktop.
This JSOM code snippet retrieves the value of master page customization is allowed on 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.allowMasterPageEditing (sp.js) | |
//Supports SharePoint 2010 + and SharePoint Online | |
function getMasterPageAccess() { | |
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 master page editing is allowed on this site collection | |
if (oSite.get_allowMasterPageEditing()) | |
siteInfo = 'MasterPage customization: Allowed'; | |
else | |
siteInfo = 'MasterPage customization: Not Allowed'; | |
alert(siteInfo.toString()); | |
}), | |
Function.createDelegate(this, function(sender, args) { | |
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); | |
})); | |
} | |
function injectMethod() { | |
getMasterPageAccess(); | |
} | |
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment