For example:
I have a site under this url: http://intranet.contoso.com/news
When I open it i would like to read it's GUID for future use in my custom AssetPortalBrowser.aspx url picker.
Thanks!
For example:
I have a site under this url: http://intranet.contoso.com/news
When I open it i would like to read it's GUID for future use in my custom AssetPortalBrowser.aspx url picker.
Thanks!
Use get_id to get the GUID
var value = SP.Web.get_id();
Example usage:
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getSite, "sp.js");
var context = null;
var web = null;
function getSite() {
context = new SP.ClientContext.get_current();
web = context.get_web();
context.load(web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}
function onSuccessMethod(sender, args) {
alert('your are there :' + web.get_title() + '\n ID:' + web.get_id());
}
function onFaiureMethodl(sender, args) {
alert('you suck ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>