Condividi tramite


SharePoint 2010 Client Object Model

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

This section of the Microsoft SharePoint 2010 Software Development Kit (SDK) introduces three new client APIs that allow you to interact with SharePoint sites from script that executes in the browser, from code (no earlier than Microsoft .NET Framework 3.5) that executes in a .NET managed application, or from code that executes in a Microsoft Silverlight 2.0 application. The new ECMAScript (JavaScript, JScript), .NET managed, and Silverlight client object models each provide a subset of the server object model that is defined in Microsoft.SharePoint.dll, including objects that correspond to major objects at the site-collection level or lower in the SharePoint Foundation hierarchy. To improve security and performance, the client object models focus on the most relevant APIs for client-side development, and do not contain all the types and members that are represented in the server object model. Limiting the size of the client libraries reduces the amount of time that is required to download the libraries in the Silverlight and JavaScript contexts. In addition, the new APIs are designed to minimize the number of round trips that must be implemented for common actions. The object models provide a consistent and easy-to-use, object-oriented system for interoperating with SharePoint data from a remote client or server. The managed client object model can be used within the context of Microsoft Business Connectivity Services (BCS) applications.

The new client object models share structural design traits, such as object model hierarchy, object identity, data retrieval semantics, client context, infrastructural client objects, collections, and exception handling. The object models are consistent with the SharePoint Foundation server object model, so if you are familiar with the server-side API, you can quickly learn to use the client-side .NET managed, Silverlight, or JavaScript API. Although the client object models do not have parity with the server object model, they generally have parity with each other, so when you learn one subset of the server object model, you have also learned most of the other subsets. Whenever possible, the new object models borrow asynchronous paradigms from .NET Framework—in particular from ADO.NET.

The client object models are provided through proxy .js and managed .dll files, respectively, which can be referenced in custom applications like other object models. The object models are implemented as a Windows Communication Foundation (WCF) service (.../_vti_bin/client.svc), but uses Web bindings to implement efficient request batching. All operations are inherently asynchronous, and commands are serialized into XML and sent to the server in a single HTTP request. For every command, a corresponding server object model call is made, and the server returns a response to the client in compacted JavaScript Object Notation (or JSON) format, which the proxy parses and associates with appropriate objects.

Note

The .js files that hold the JavaScript client APIs are referenced in the standard SharePoint Foundation master page, so they are downloaded automatically to the client. The Silverlight client APIs are in DLL files that can be encased inside the Silverlight .xap file. To get the DLLs containing the .NET managed client APIs onto the client computers, they must be distributed along with the application by using Microsoft's SharePoint Foundation 2010 Client Object Model Redistributable.

For language reference information about types and members in the .NET managed and Silverlight object models, see Client Class Library, and for language information about the JavaScript object model, see JavaScript Class Library.

For more information about the SharePoint Foundation managed client object model, see Using the SharePoint Foundation 2010 Managed Client Object Model. For information about how to use the client object model to work with Microsoft Office 2010 and Open XML documents, see Using the SharePoint Foundation 2010 Managed Client Object Model with the Open XML SDK 2.0. In addition, the Client Object Model Resource Center provides links to various other resources that can help you use the client object models.

In This Section

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

Client Object Model Distribution and Deployment

Managed Client Object Models in SharePoint Foundation 2010

JavaScript Object Model

Client Class Library

JavaScript Class Library

See Also

Other Resources

Using the SharePoint Foundation 2010 Managed Client Object Model

Client Object Model Resource Center