ECMA Script : To get all the properties of the web sites in SharePoint 2010

 

 

<script language="ecmascript" type="text/ecmascript">

 

    var clientContext = null;

    var web = null;

 

    function getWebProperties() {

 

        clientContext = new SP.ClientContext.get_current();

        web = clientContext.get_web();

        clientContext.load(web);

        clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

    }

 

    function onQuerySucceeded() {

 

        var message = "Web retrieved:";

        message += "\n Title: " + web.get_title();

        message += "\n Description: " + web.get_description();

        alert(message);

    }

 

 

    function onQueryFailed(sender, args) {

        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

    }

</script>

 

<input id="btnGetWebProperties" onclick="getWebProperties()" type="button" value="Get the web properties"/>

Ebook Download
View all
Learn
View all