Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRootWeb() {
- //Get and load a reference to the root web of the current site collection.
- var ctx = new SP.ClientContext("http://Server/sites/sitecollection/");
- var site = ctx.get_site();
- var rootWeb = site.get_rootWeb();
- ctx.load(rootWeb);
- //Ask SharePoint to pull data for us
- ctx.executeQueryAsync(onQuerySucceed,onQueryFailed);
- };
- //Function executed on success
- function onQuerySucceed() {
- alert(this.rootWeb.get_title());
- };
- //Function executed on failure
- function onQueryFailed(sender, args) {
- alert('Unable to retrieve data from the SharePoint. Request failed. ' + args.get_message() + 'n' + args.get_stackTrace());
- };
Add Comment
Please, Sign In to add comment