Skip to content

Instantly share code, notes, and snippets.

@RyanHirsch
Created May 31, 2013 17:05
Show Gist options
  • Save RyanHirsch/5686396 to your computer and use it in GitHub Desktop.
Save RyanHirsch/5686396 to your computer and use it in GitHub Desktop.
SharePoint Javascript CSOM to get site and web objects of the current site
var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
var site = ctx.get_site();
ctx.load(site);
ctx.load(web);
ctx.executeQueryAsync(function() {
console.log('success');
}, function() {
console.log('error');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment