KEMBAR78
SharePoint 2010 Client Object Model | KEY
AN INTRODUCTION TO THE NEW CLIENT OBJECT
                   MODEL
             IN SHAREPOINT 2010




OR: WE DON’T NEED NO STINKIN’ GOLD-PLATED WEB-SERVICES!
Developing applications using
the SharePoint 2010 Client APIs.

 G. Scott Singleton - Principal SharePoint Architect
 i3solutions, Inc. - Sterling, VA.
   Involved with SharePoint 2010 since May 2009
   One TAP project and three current RTM projects
Learn from yesterday, live for
 today, hope for tomorrow.
The important thing is not to
     stop questioning.

       Albert Einstein
I do “Code Solutions”.
None of this “No-Code”
crap.
There’s no way to take advantage of all of the rich client
experience gains in SP 2010 without code.
Why waste 40 hours looking for that no-code solution
when you could have developed the code-solution in
1/3 the time.
Hell, that’s why we make the big money.
Gotcha! Bet you didn’t think you would see the
 new SharePoint pie in a developer session eh?
Working with SharePoint
Client Applications Today
      in WSS 3.0...
Accessing SharePoint Data

    SharePoint Data (SQL)


       SharePoint API        SharePoint /
                               Server
  SharePoint    Custom Web   Applications
 Web Services     Services



        Your Client
        Application
Working With SharePoint
Client Applications NOW
   in SharePoint 2010
Tomorrow
 ‘RESTful’ Architecture
 ADO.NET Data Services Framework
     Formerly Known as “Astoria”

     ADO.NET Data Services (CTP 2) Required on Server for Beta, RTM for
     Release Candidate

 JSON - JavaScript Object Notation
 Client Object Model (Client OM)
JSON? WTH?
 WASN’T HE IN MY ADVANCED PHYSICS LAB BACK
 IN CALI?
JavaScript Object Notation



   {"menu": {
     "id": "file",
     "value": "File",
     "popup": {
       "menuitem": [
         {"value": "New", "onclick": "CreateNewDoc()"},
         {"value": "Open", "onclick": "OpenDoc()"},
         {"value": "Close", "onclick": "CloseDoc()"}
       ]
     }
   }}


basically a string containing the javascript
  code to create the object in memory
phew! I need a REST!
Using the REST API
                      Representational
                       State Transfer

REST API provided through ADO.NET Data Services
Framework via WCF
/_vti_bin/ListData.svc is base service -- and it is case
sensitive
Can be used to bind to data services from client
applications with ADO.NET Data Services CTP 2
(or Data Services Update for .NET 3.5 SP1 )
A Quick note on Data
 Services Compatibility
If you want to try out Data Services with the SharePoint 2010 Beta today you
have to use CTP2 of Data Services v1.5, because unfortunately the Data Service
RTM version, aka the Data Services Update for .NET 3.5 SP1 is incompatible with
the SharePoint 2010 Beta.

This is a point in time issue – when SharePoint RTMs it will work seamlessly with
the Data Services Update for .NET 3.5 SP1.

Alex James
Program Manager
Microsoft
Atomized Data via REST
By using The REST API We can retrieve atomized
             data directly from a list
RESTful api Demo
cross your fingers!
Available QueryString
parameters
 Default Parameter is item ID and enclosed in parens. ( Links(1) )
 $filter - formatted like a CAML query
 $expand - returns parent object (lookups, relations, etc)
 $orderby - Sets return order by
 $skip - Skips x items
 $top - Returns top x ($top=2 returns top 2)
 Can be stacked together
 example: $orderby=Title&top=1
Client Object Model
Simple API to Add, Retrieve and Update data within
SharePoint 2010
Supports three major client development languages.
    .NET CLR
    JavaScript
    Silverlight CLR

Gives you consistency and efficiency across the
development platforms
Unfortunately you’re still stuck with CAML for the
initial query to the server.
Benefits of Client Object
Model
 A Richer User eXperience (UX) than the simple
 WebForms post-back model
 Reduces impact on server by executing more
 processes on the client’s machine
 Normalizes calls between three available client
 architectures.
 Batches calls to reduce roundtrip
 Provides Asynchronous ability for better UX
 performance
 Late stage data retrieval - returns all the data you
 need, but only the data you need.
What we currently do
.NET CLR client code
Using the client OM in
SilverLight
  Silverlight is Asynchronous by Nature
  Provides both an ExecuteQuery() and
  ExecuteQueryAsync() Method -- but if you’re updating
  the UI you MUST use the Asynchronous call.
  Must provide success and failure callbacks for UI
  Updates
  Must hand off UI work to the dispatcher
  Similar nomenclature to the .NET CLR
DEMO - .NET and Silverlight
CLR - Cross your fingers!
Client Object Model Summary
  Similar constructs and naming convention as Server
  Object Model; reduces developer ramp-up time.
  Reduction of server overhead by offloading processes
  onto the client
  Improves the client’s UX dramatically
  Reduction of round-trips to server via late-stage
  batching
  No need for messy custom web services
  All around cool
Don’t forget to fill out your
 speaker survey forms.
   scottsingleton on twitter - follow me foo
   scott.singleton@i3solutions.com
   http://www.i3solutions.com

  Looking for SharePoint Consulting? -- Call us!

  Looking for a challenging career in SharePoint
development with one of THE leaders in Microsoft’s
         Mid-Atlantic region? -- Call us!

SharePoint 2010 Client Object Model

  • 1.
    AN INTRODUCTION TOTHE NEW CLIENT OBJECT MODEL IN SHAREPOINT 2010 OR: WE DON’T NEED NO STINKIN’ GOLD-PLATED WEB-SERVICES!
  • 2.
    Developing applications using theSharePoint 2010 Client APIs. G. Scott Singleton - Principal SharePoint Architect i3solutions, Inc. - Sterling, VA. Involved with SharePoint 2010 since May 2009 One TAP project and three current RTM projects
  • 3.
    Learn from yesterday,live for today, hope for tomorrow. The important thing is not to stop questioning. Albert Einstein
  • 4.
    I do “CodeSolutions”. None of this “No-Code” crap. There’s no way to take advantage of all of the rich client experience gains in SP 2010 without code. Why waste 40 hours looking for that no-code solution when you could have developed the code-solution in 1/3 the time. Hell, that’s why we make the big money.
  • 5.
    Gotcha! Bet youdidn’t think you would see the new SharePoint pie in a developer session eh?
  • 6.
    Working with SharePoint ClientApplications Today in WSS 3.0...
  • 7.
    Accessing SharePoint Data SharePoint Data (SQL) SharePoint API SharePoint / Server SharePoint Custom Web Applications Web Services Services Your Client Application
  • 8.
    Working With SharePoint ClientApplications NOW in SharePoint 2010
  • 9.
    Tomorrow ‘RESTful’ Architecture ADO.NET Data Services Framework Formerly Known as “Astoria” ADO.NET Data Services (CTP 2) Required on Server for Beta, RTM for Release Candidate JSON - JavaScript Object Notation Client Object Model (Client OM)
  • 10.
    JSON? WTH? WASN’THE IN MY ADVANCED PHYSICS LAB BACK IN CALI?
  • 11.
    JavaScript Object Notation {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} basically a string containing the javascript code to create the object in memory
  • 12.
    phew! I needa REST!
  • 13.
    Using the RESTAPI Representational State Transfer REST API provided through ADO.NET Data Services Framework via WCF /_vti_bin/ListData.svc is base service -- and it is case sensitive Can be used to bind to data services from client applications with ADO.NET Data Services CTP 2 (or Data Services Update for .NET 3.5 SP1 )
  • 14.
    A Quick noteon Data Services Compatibility If you want to try out Data Services with the SharePoint 2010 Beta today you have to use CTP2 of Data Services v1.5, because unfortunately the Data Service RTM version, aka the Data Services Update for .NET 3.5 SP1 is incompatible with the SharePoint 2010 Beta. This is a point in time issue – when SharePoint RTMs it will work seamlessly with the Data Services Update for .NET 3.5 SP1. Alex James Program Manager Microsoft
  • 15.
  • 16.
    By using TheREST API We can retrieve atomized data directly from a list
  • 17.
    RESTful api Demo crossyour fingers!
  • 18.
    Available QueryString parameters DefaultParameter is item ID and enclosed in parens. ( Links(1) ) $filter - formatted like a CAML query $expand - returns parent object (lookups, relations, etc) $orderby - Sets return order by $skip - Skips x items $top - Returns top x ($top=2 returns top 2) Can be stacked together example: $orderby=Title&top=1
  • 19.
    Client Object Model SimpleAPI to Add, Retrieve and Update data within SharePoint 2010 Supports three major client development languages. .NET CLR JavaScript Silverlight CLR Gives you consistency and efficiency across the development platforms Unfortunately you’re still stuck with CAML for the initial query to the server.
  • 21.
    Benefits of ClientObject Model A Richer User eXperience (UX) than the simple WebForms post-back model Reduces impact on server by executing more processes on the client’s machine Normalizes calls between three available client architectures. Batches calls to reduce roundtrip Provides Asynchronous ability for better UX performance Late stage data retrieval - returns all the data you need, but only the data you need.
  • 23.
  • 24.
  • 25.
    Using the clientOM in SilverLight Silverlight is Asynchronous by Nature Provides both an ExecuteQuery() and ExecuteQueryAsync() Method -- but if you’re updating the UI you MUST use the Asynchronous call. Must provide success and failure callbacks for UI Updates Must hand off UI work to the dispatcher Similar nomenclature to the .NET CLR
  • 27.
    DEMO - .NETand Silverlight CLR - Cross your fingers!
  • 28.
    Client Object ModelSummary Similar constructs and naming convention as Server Object Model; reduces developer ramp-up time. Reduction of server overhead by offloading processes onto the client Improves the client’s UX dramatically Reduction of round-trips to server via late-stage batching No need for messy custom web services All around cool
  • 29.
    Don’t forget tofill out your speaker survey forms. scottsingleton on twitter - follow me foo scott.singleton@i3solutions.com http://www.i3solutions.com Looking for SharePoint Consulting? -- Call us! Looking for a challenging career in SharePoint development with one of THE leaders in Microsoft’s Mid-Atlantic region? -- Call us!