共用方式為


Client Object Model Distribution and Deployment

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

To use the client object models, you can obtain local copies of the appropriate .dll or .js files to develop from a remote computer on which Microsoft SharePoint Foundation 2010 is not installed.

Note

You can use the managed client object model within the context of Microsoft Business Connectivity Services (BCS) applications.

.NET Managed Deployment

Microsoft SharePoint Foundation 2010 installs Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI for easy access in development. You must have both Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll to develop a solution remotely with the .NET managed object model. For a Windows Forms, Windows Presentation Foundation (WPF), or other application that calls the .NET managed SharePoint Foundation client APIs, to function, the client computer must have the SharePoint Foundation client DLLs installed. The client DLLs must be distributed with the application by using Microsoft's SharePoint Foundation 2010 Client Object Model Redistributable.

For an example that shows how to create a console application that uses the .NET managed object model, see Creating a Basic SharePoint Foundation Client Application.

Silverlight Deployment

For Silverlight client installations, Microsoft SharePoint Foundation 2010 deploys Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll into the special scripts-only folder %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\ClientBin. This folder is designed to be a standard place for hosting assemblies that are used in Silverlight. You must have both Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll to develop a solution remotely with the Silverlight object model. The author of a Silverlight application can package the client-side DLLs together in the .xap file for download. It is also possible to cache the Silverlight DLLs.

For information about how to implement the SharePoint Foundation 2010 Silverlight object model in a Silverlight application, see Using the Silverlight Object Model.

ECMAScript Deployment

Minified .js files for the ECMAScript (JavaScript, JScript) client object model, such as SP.js, SP.Core.js, SP.Ribbon.js, and SP.Runtime.js, are installed in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS directory. When the client computer browses to any SharePoint Foundation page that uses the standard SharePoint Foundation master page, these .js files are downloaded to the client. If a custom master page is being used, then either the master page or the content page must reference these .js files if the client object model is being used.

SharePoint Foundation also installs unminified, debug versions of the .js files in the same directory, for example, SP.debug.js, SP.Core.debug.js, SP.Ribbon.debug.js, and SP.Runtime.debug.js, and you can specify whether the debug versions are used. Default master pages in SharePoint Foundation insert a ScriptManager control in Web pages, and the ScriptMode property of this control is set to Auto by default. You can override this default setting and use the debug .js files by adding <deployment retail="false" /> to the system.web section of the web.config file, which is located in the %inetpub%\wwwroot\wss\VirtualDirectories\80 directory.

The following list shows important debug .js files that are installed in the /_layouts folder:

  • SP.debug.js

  • SP.Core.debug.js

  • SP.Ribbon.debug.js

  • SP.Runtime.debug.js

  • JsGrid.debug.js

  • JsGrid.Gantt.debug.js

In order to use the JavaScript object model, a computer must support the minimum set of requirements needed for ASP.NET AJAX and SharePoint Foundation 2010. Supported browsers include:

  • Microsoft Internet Explorer 7 and greater

  • Firefox 3.5 and greater

  • Safari 4.0 and greater

For basic information about how to use the JavaScript object model within an .aspx page or .js file, see Setting Up an Application Page for JavaScript.

See Also

Concepts

Differences Between Managed and JavaScript Object Models

Authentication in the Managed Client Object Models

Other Resources

Client Class Library

JavaScript Class Library

Using the SharePoint Foundation 2010 Managed Client Object Model

Client Object Model Resource Center