building dynamic applications with the sharepoint client object model

Upload: eric-shupps

Post on 03-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    1/20

    Building Dynamic Applicationswith the SharePoint Client Object

    Model

    Eric Shupps

    SharePoint Server MVP

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    2/20

    About Me

    SharePoint Server MVP President, BinaryWave Microsoft Patterns & Practices ( spg.codeplex.com ) CKS:DEV ( cksdev.codeplex.com ) Web: www.binarywave.com Blog: www.sharepointcowboy.com

    Twitter: @eshupps Facebook: www.facebook.com/sharepointcowboy

    http://spg.codeplex.com/http://spg.codeplex.com/http://www.binarywave.com/http://www.sharepointcowboy.com/http://twitter.com/http://www.facebook.com/sharepointcowboyhttp://www.facebook.com/sharepointcowboyhttp://twitter.com/http://twitter.com/http://www.sharepointcowboy.com/http://www.binarywave.com/http://spg.codeplex.com/http://spg.codeplex.com/
  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    3/20

    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 Applicationswith SharePoint Data

    This session is a hunky dory jolly goodawesomeness thingy

    - Tobias Zimmergren

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    4/20

    Legacy Data Access

    SharePoint Data

    SharePoint API

    Web Service

    Client Application

    Server

    Application

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    5/20

    Client Object Model

    .Net CLR Silverlight JavaScript

    Client Application

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    6/20

    Accessing Data with Client OM

    ContentDatabase

    ServerObject

    Model

    ClientService

    JavaScript Controls

    JavaScript OM

    Proxy

    Managed Controls

    Proxy

    Managed OM

    Browser

    Client Server

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    7/20

    Equivalent Objects

    Server(Microsoft.SharePoint)

    .NET Managed(Microsoft.SharePoint.Client)

    Silverlight(Microsoft.SharePoint.Client.Silverlight)

    JavaScript(SP.js)

    SPContext ClientContext ClientContext clientContext

    SPSite Site Site site

    SPWeb Web Web web

    SPList List List list

    SPListItem ListItem ListItem listItem

    SPField Field Field field

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    8/20

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    9/20

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    10/20

    Client Object Model Limitations

    You must handle synch/update semantics incode

    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)

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    11/20

    .Net CLR Client OM

    Provides easy access from remote .NET clientsto 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

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    12/20

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    13/20

    Silverlight in SharePoint 2010

    Native Silverlight web part allows for compilationand 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!)

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    14/20

    Silverlight CLR Client OM

    Use the correct references: C:\Program Files\Common Files\Microsoft

    Shared\Web Server Extensions

    \14\TEMPLATE\LAYOUTS\ClientBin Microsoft.SharePoint.Client.Silverlight

    262KB

    Microsoft.SharePoint.Client.Silverlight.Runtime

    138KB

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    15/20

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    16/20

    Building and Deploying Silverlight

    Built in support in Visual Studio 2010 Redirect assembly output into Module F5 deploy and debug experience

    SharePoint WSP

    Module

    Visual Studiobuilds WSPpackage onF5 XAP

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    17/20

    DEMOBuilding a Silverlight Client OM ApplicationUsing SharePoint Data

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    18/20

    JavaScript Client OM

    Provides similar functionality to .NET/Silverlight COM fromJavaScript/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()

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    19/20

    DEMOBuilding a Javascript Client OM ApplicationUsing SharePoint Data

  • 8/12/2019 Building Dynamic Applications With the SharePoint Client Object Model

    20/20

    Your Feedback is Important

    Please fill out a session evaluation form.

    Thank you!