Skip to content

Instantly share code, notes, and snippets.

@sksnips
Last active March 3, 2016 05:59
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/d4f7a4012fc665cf018c to your computer and use it in GitHub Desktop.
Save sksnips/d4f7a4012fc665cf018c to your computer and use it in GitHub Desktop.
Code snippets helps to enable the SharePoint Designer Access to the Site Collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowDesigner (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function enableSiteDesignerAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enable the designer access
oSite.set_allowDesigner(true);
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
if (oSite.get_allowDesigner())
siteInfo = 'Designer Access: Allowed';
else
siteInfo = 'Designer Access: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
enableSiteDesignerAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment