Introduction to the Client OM in SharePoint 2010


Published on

This session was presented by Ben Robb and Eric Shupps at the SharePoint Evolution Conference in London, in April 2010.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to the Client OM in SharePoint 2010

  1. 1. The Client Object Model in SharePoint 2010 DEV110 Ben Robb & Eric Shupps
  2. 2. <ul><li>Ben Robb, MVP </li></ul><ul><ul><li>Chief Technology Officer, cScape </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul><ul><li>Eric Shupps, MVP </li></ul><ul><ul><li>President, BinaryWave </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li>Blog: </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul>
  3. 3. Agenda <ul><li>Introduction to Client Object Model </li></ul><ul><li>.NET Client Object Model </li></ul><ul><li>Silverlight and Client Object Model </li></ul><ul><li>JavaScript and Client Object Model </li></ul>
  4. 4. Accessing Data in SharePoint 2007
  5. 5. How can this be improved <ul><li>Web Services can be complicated </li></ul><ul><li>Difficult to call from JavaScript </li></ul><ul><li>Often custom wrapper services are created </li></ul><ul><li>Customers solve the same problem over and over again </li></ul>
  6. 6. Client Object Model <ul><li>Simple and easy to use API to Add, Retrieve, Update and Manage Data in SharePoint. </li></ul>Client Application
  7. 7. Accessing Data with Client OM Content Database JavaScript OM Proxy Proxy Managed OM Browser Client Server Server Object Model Client Service JavaScript Controls Managed Controls
  8. 8. Equivalent Objects Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
  9. 9. Major Objects in Client Object Model Site Web ListItem Field View Form Folder List NavigationNode Navigation UserCustomAction ContentType RoleDefinition WorkflowAssociation WorkflowTemplate RoleAssignment Change WebPart File User Interface Security Logic
  10. 10. <ul><li>1. ClientContext is the central object </li></ul><ul><li>2. Before you read a property, you have to ask for it </li></ul><ul><li>3. All requests must be committed in a batch </li></ul>Getting Started: 3 things to know clientContext.ExecuteQuery(); clientContext.Load(list); clientContext = new ClientContext(“http://mysite”);
  11. 11. High level handling of commands XML JSON Execute commands in the batch: Client.svc Sequence of commands: context.ExecuteQuery(); command 1; command 2; command 3; Send results back command 1; command 2; command 3; Process results Server Client Application
  12. 12. Client Object Model Limitations <ul><li>You still need to handle synch/update semantics (change log could help) </li></ul><ul><li>No elevation of privilege capabilities </li></ul><ul><li>Requests are throttled </li></ul><ul><li>.net CLR has sync method; Silverlight CLR and Jscript are async </li></ul>
  13. 13. .Net CLR Client OM <ul><li>Provides easy access from remote .NET clients to manipulate SharePoint data </li></ul><ul><li>Can be utilized from managed code – also from office clients etc. </li></ul><ul><li>Assemblies </li></ul><ul><ul><li>Microsoft.SharePoint.Client.dll (281kb) </li></ul></ul><ul><ul><li>Microsoft.SharePoint.Client.Runtime.dll (145kb) </li></ul></ul><ul><ul><ul><li>To Compare: Microsoft.SharePoint.dll – 15.3MB </li></ul></ul></ul>
  14. 14. .NET CLIENT OBJECT MODEL <ul><li>How do I utilize client object model in my windows apps? </li></ul>
  15. 15. Silverlight in SharePoint 2010 <ul><li>Can use Silverlight in separate ASPX page or in Web Part </li></ul><ul><li>The web part can contain custom properties that are sent to Silverlight via the InitParams property </li></ul><ul><li>The XAP file can be deployed to LAYOUTS or content database and loaded at run time </li></ul><ul><li>The Silverlight application can then make use of the Client OM </li></ul>
  16. 16. Integrating with SharePoint <ul><li>Web Services </li></ul><ul><ul><li>More coverage </li></ul></ul><ul><li>Client Object Model </li></ul><ul><ul><li>Site, navigation </li></ul></ul><ul><ul><li>security services </li></ul></ul><ul><ul><li>Very flexible and straight forward </li></ul></ul><ul><li>REST </li></ul><ul><ul><li>Easiest to use </li></ul></ul><ul><ul><li>For fixed list schema </li></ul></ul>Web Services Advanced Operations SharePoint Server Operations Client OM Advanced List Operations Site Operations Security REST Working with list data, fixed schema
  17. 17. Silverlight CLR Client OM <ul><li>C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions 14TEMPLATELAYOUTSClientBin </li></ul><ul><ul><li>Microsoft.SharePoint.Client.Silverlight </li></ul></ul><ul><ul><ul><li>262KB </li></ul></ul></ul><ul><ul><li>Microsoft.SharePoint.Client.Silverlight.Runtime </li></ul></ul><ul><ul><ul><li>138KB </li></ul></ul></ul><ul><li>Redistributable planned for the assemblies </li></ul><ul><ul><li>Also XAP file that can be dynamically included to Silverlight application </li></ul></ul>
  18. 18. Silverlight Client OM
  19. 19. Building and Deploying Silverlight <ul><li>Built in support in Visual Studio 2010 </li></ul><ul><li>Sandboxed and Farm Solutions support </li></ul><ul><li>F5 deploy and debug experience </li></ul>SharePoint WSP Silverlight XAP
  21. 21. Thank you for attending!