다음을 통해 공유


SharePoint 2010 Client Object Model Hierarchy and Identity

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

Microsoft SharePoint Foundation 2010 has three object models for working on the client-side. These are the managed .NET object model, the managed Silverlight object model, and the unmanaged ECMAScript (JavaScript, JScript) object model. Each object model has different applications. The two managed object models are used primarily for rich applications that have to access SharePoint data. This could be a Silverlight application in the browser or a desktop application. The JavaScript object model is used when you are working inside the client browser. This object model is used when you are working with the Server ribbon or inside sandboxed solutions.

For information about the differences between the object models, see Differences Between Managed and JavaScript Object Models. For information about how to include each of these object models, see Client Object Model Distribution and Deployment and Setting Up an Application Page for JavaScript.

SharePoint Foundation 2010 Namespaces

Microsoft.SharePoint.Client is the core namespace used for the .NET managed and Silverlight object models, and SP is the core namespace for the JavaScript object model. Client objects and their respective collection objects inherit from the ClientObject (JavaScript: ClientObject) and ClientObjectCollection (JavaScript: ClientObjectCollection) classes.

In addition to the core namespace, SharePoint Foundation 2010 provides the following namespaces.

.NET Managed and Silverlight

JavaScript

Microsoft.SharePoint.Client.Application

N/A

N/A

SP.Application.UI

N/A

SP.Ribbon

N/A

SP.Ribbon.PageState

N/A

SP.Ribbon.TenantAdmin

N/A

SP.UI

N/A

SP.UI.ApplicationPages

Microsoft.SharePoint.Client.Utilities

SP.Utilities

Microsoft.SharePoint.Client.WebParts

SP.WebParts

Microsoft.SharePoint.Client.Workflow

SP.Workflow

The following table shows the equivalent objects that the new APIs provide for common SharePoint Foundation 2010 server objects.

Server

.NET Managed and Silverlight

JavaScript

Microsoft.SharePoint.SPContext

Microsoft.SharePoint.Client.ClientContext

SP.ClientContext

Microsoft.SharePoint.SPSite

Microsoft.SharePoint.Client.Site

SP.Site

Microsoft.SharePoint.SPWeb

Microsoft.SharePoint.Client.Web

SP.Web

Microsoft.SharePoint.SPList

Microsoft.SharePoint.Client.List

SP.List

Microsoft.SharePoint.SPListItem

Microsoft.SharePoint.Client.ListItem

SP.ListItem

Microsoft.SharePoint.SPField (including major derived classes)

Microsoft.SharePoint.Client.Field

SP.Field

Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager

Microsoft.SharePoint.Client.WebParts.LimitedWebPartManager

SP.WebParts.LimitedWebPartManager

The new client APIs do not provide administration objects or objects that are scoped higher than site collection: SPSite class in the server object model.

Object Identity Path

When you work with SharePoint objects in one of the client object models, SharePoint Foundation retains object identity, which means that multiple operations and queries can occur with the same object over time. This helps prevent objects from becoming "stale" and helps to ensure that changes to objects are reflected when the object is obtained subsequently. To this end, SharePoint Foundation maintains an object identity path between calls to the ExecuteQuery() or ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) method (JavaScript: executeQueryAsync(succeededCallback, failedCallback)), so that if an object is created in one call, the client will use the same object path in subsequent calls within the same context.

Note

Separate contexts do not support object identity as a feature.

See Also

Concepts

Client Context as Central Object

Client Objects, Value Objects, and Scalar Properties

SharePoint Client Object Creation

SharePoint 2010 Client Object Model Guidelines

Differences Between Managed and JavaScript Object Models

Common Programming Tasks in the Managed Client Object Model

Other Resources

Client Class Library

JavaScript Class Library

Using the SharePoint Foundation 2010 Managed Client Object Model

Client Object Model Resource Center