JavaScript Object Model

Applies to: SharePoint Foundation 2010

The ECMAScript (JavaScript, JScript) object model was introduced in Microsoft SharePoint Foundation 2010 along with the managed and Silverlight client object models. The JavaScript object model enables you to work with objects without deploying code on the server. Being able to work with objects on the client side is useful when deploying a sandboxed solution or working with the Server ribbon. Due to the nature of JavaScript, all code is executed asynchronously and relies on callback functions to work with objects inside of SharePoint Foundation 2010. JavaScript can work only with objects in the current context. That is, there is no ability to do cross-site scripting or access objects outside of the current context.

To minimize stress on the server, not all object properties are loaded when an object is created. You will have to request specific properties using Include statements and the load(clientObject) function. You can read more about working with objects in Data Retrieval Overview. JavaScript does not support properties as in the managed client object model. The JavaScript object model exposes properties using methods that are prepended with set_ and get_ based on the ability to retrieve or set the value of that property. The JavaScript Class Library contains reference material for objects and their properties. Due to the similarities between the managed object model and the JavaScript object model, there are shared topics covering information that applies to both. The following topics are shared across the managed and JavaScript object model. For information on the differences between the managed and JavaScript object models, see Differences Between Managed and JavaScript Object Models.

In This Section

Common Programming Tasks in the JavaScript Object Model

Reference

SharePoint 2010 Client Object Model Hierarchy and Identity

Client Context as Central Object

Client Objects, Value Objects, and Scalar Properties

Data Retrieval Overview

SharePoint Client Object Creation

SharePoint 2010 Client Object Model Guidelines

Differences Between Managed and JavaScript Object Models

JavaScript Class Library