SharePoint Client Object Model (ECMAScript) #2 – Update Web Properties

SharePoint Client Object Model (ECMAScript) provides the capabilities of SharePoint Server Object capabilities at the client side. In this tutorial, let me show you how you can play around with the Client Object Model through IE Developer Toolbar how to update Web properties.

Check the screenshot below, to know what we are trying to achieve here:

Below is the function that i have used:

    function updateTitle() {
        var ctx = new SP.ClientContext.get_current();
        this.web = ctx.get_web();
        ctx.executeQueryAsync(Function.createDelegate(this, this.onUpdate),
            Function.createDelegate(this, this.onFail));
    function onUpdate(sender, args) {
        alert(‘title updated’);
    function onFail(sender, args) {
        alert(‘failed to update title. Error:’+args.get_message());
ExecuteOrDelayUntilScriptLoaded(updateTitle, “sp.js”); 

The above ECMAScript access the SharePoint’s client context object and updates the Title property of it. It is essential to note that “SP.js” is loaded before this script execution occurs. This is the reason for using the “ExecuteOrDelayUntilScriptLoaded” function.

  1. Thank you for some other excellent article.
    Where else may just anybody get that type of info in such a perfect means of writing?
    I’ve a presentation next week, and I am at the search for such info.


Feel free to leave a reply here...

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: