Building dynamic applications with the share point client object model


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

No notes for slide
  • Show the various resources and their locationsServer – Microsoft.SharePoint – [..]\\14\\ISAPI .NET – Microsoft.SharePoint.Client – [..]\\14\\ISAPISilverlight – Microsoft.SharePoint.Client.Silverlight – [..]\\14\\LAYOUTS\\ClientBinECMAScript– SP.js - [..]\\LAYOUTS
  • Building dynamic applications with the share point client object model

    1. 1. Building Dynamic Applicationswith the SharePoint Client Object Model Eric Shupps SharePoint Server MVP
    2. 2. About Me• SharePoint Server MVP• President, BinaryWave• Microsoft Patterns & Practices (• CKS:DEV (• Web:• Blog:• Twitter: @eshupps• Facebook:
    3. 3. Agenda• Introduction to the Client Object Model• .NET Client Object Model• Silverlight and Client Object Model• JavaScript and Client Object Model• Demos • Building .NET, Silverlight, Javascript and WPF Client Applications with SharePoint Data “T h i s s e s s i o n i s a hunk y dor y j ol l y g o o d a w e s o me n e s s t hi ngy ” - Tobias Zimmergren
    4. 4. Legacy Data Access SharePoint Data Server SharePoint API Application Web Service Client Application
    5. 5. Client Object Model Client Application .Net CLR Silverlight JavaScript
    6. 6. Accessing Data with Client OMBrowser JavaScript Controls Server JavaScript OM Object Model Proxy Client Service Proxy Managed OM Content Database Managed ControlsClient Server
    7. 7. Equivalent ObjectsServer .NET Managed Silverlight JavaScript(Microsoft (Microsoft.SharePoint (Microsoft.SharePoint (SP.js).SharePoint) .Client) .Client.Silverlight)SPContext ClientContext ClientContext clientContextSPSite Site Site siteSPWeb Web Web webSPList List List listSPListItem ListItem ListItem listItemSPField Field Field field
    8. 8. Getting Started: 3 things to know• ClientContext is the central object clientContext = new ClientContext(“http://mysite”);• Before you read a property, you have to ask for it clientContext.Load(list);• All requests must be committed in a batch clientContext.ExecuteQuery();
    9. 9. High level handling of commands Client Application Server Sequence of Client.svc commands: command 1; command 2; Execute commands command 3; in the batch: XML context.ExecuteQuery(); command 1; command 2; command 3; JSON Process results Send results back
    10. 10. Client Object Model Limitations• You must handle synch/update semantics in code• No elevation of privilege capabilities• Requests are throttled• .net CLR has sync method; Silverlight CLR and Jscript are async• Limited subset of Server OM functionality• You only get what you ask for – nothing more (but sometimes less)
    11. 11. .Net CLR Client OM• Provides easy access from remote .NET clients to manipulate SharePoint data• Can be utilized from managed code – also from office clients etc.• Assemblies ● Microsoft.SharePoint.Client.dll (281kb) ● Microsoft.SharePoint.Client.Runtime.dll (145kb) • To Compare: Microsoft.SharePoint.dll – 15.3MB
    12. 12. DEMOBuilding a .NET Client OM ApplicationUsing SharePoint Data
    13. 13. Silverlight in SharePoint 2010• Native Silverlight web part allows for compilation and deployment of XAP-only solutions• One-click deployment from Visual Studio 2010• Web Parts can contain custom properties that are sent to Silverlight via the InitParams property• Abstracted visual design in Expression (make the designer do it!)
    14. 14. Silverlight CLR Client OM• Use the correct references: ● C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions 14TEMPLATELAYOUTSClientBin –Microsoft.SharePoint.Client.Silverlight »262KB –Microsoft.SharePoint.Client.Silverlight.R untime »138KB
    15. 15. Silverlight Client OM
    16. 16. Building and Deploying Silverlight• Built in support in Visual Studio 2010• Redirect assembly output into Module• F5 deploy and debug experience SharePoint WSP Visual Studio builds WSP Module package on F5 XAP
    17. 17. DEMOBuilding a Silverlight Client OM ApplicationUsing SharePoint Data
    18. 18. JavaScript Client OM• Provides similar functionality to .NET/Silverlight COM from JavaScript/ECMAScript• Identical structure ● Initialize Context -> Specify Items -> Load Objects -> Execute Query• Limited to current site context (no cross-site scripting)• Asynchronous (like Silverlight)• Be aware of syntax changes ● get_web() ● get_lists() ● get_item()
    19. 19. DEMOBuilding a Javascript Client OM ApplicationUsing SharePoint Data
    20. 20. Your Feedback is Important Please fill out a session evaluation form. Thank you!