Skip to content

Instantly share code, notes, and snippets.

@rheid
Created February 12, 2017 19:51
Show Gist options
  • Save rheid/d415c1409356de8c3afb88e346fab6ff to your computer and use it in GitHub Desktop.
Save rheid/d415c1409356de8c3afb88e346fab6ff to your computer and use it in GitHub Desktop.
Change SharePoint Welcome Page with CSCOM
SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function() {
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var rootFolder = web.get_rootFolder();
clientContext.load(rootFolder);
clientContext.executeQueryAsync(function() {
console.log("WebWelcome Page is: " + rootFolder.get_welcomePage());
rootFolder.set_welcomePage("SitePages/HomeM.aspx");
rootFolder.update();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment