Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

Getting the site owner for SharePoint online site collection

$
0
0

Hi ,

I am trying to find the site owner here is my code,

 $(document).ready(function () {
ExecuteOrDelayUntilScriptLoaded(retrieveWebSite,"sp.js");
    });

function retrieveWebSite() {
    var clientContext = new SP.ClientContext.get_current();
	    oSite = clientContext.get_site();
   	oWebsite = clientContext.get_web();
    clientContext.load(oSite);
    clientContext.load(oWebsite);
    clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded1),
        Function.createDelegate(this, this.onQueryFailed1)
    );
}

function onQuerySucceeded1(sender, args) {
var htmlString = "Site Owner: " + oSite.get_owner.name;
$("div.Details").html(htmlString);
}

function onQueryFailed1(sender, args) {
    alert('Request failed. ' + args.get_message() +
        '\n' + args.get_stackTrace());
}
Here the oSite.get_owner.name always returns a blank value. What am I doing wrong? Please let me know


Student For Life


Viewing all articles
Browse latest Browse all 10096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>