Client Side Object Model
(CSOM) - SharePoint 2013

      KUNAAL KAPOOR


            0
Welcome to SharePoint Saturday Houston
        Thank you for being a part of the
         4th Annual SharePoint Saturday
          for the greater Houston area!
• Please turn off all electronic devices or set them to vibrate.
• If you must take a phone call, please do so in the hall so as not
  to disturb others.
• Thanks to our Title Sponsor:




                                  1
Information
• Speaker presentation slides will be available at
  bit.ly/GoSPSHOU within a week

• The Houston SharePoint User Group will be
  having it’s next meeting Wednesday April 17th.
  Please join us at www.h-spug.org




                          2
About Me



KUNAAL KAPOOR
Vice President Delivery
BrightStarr

A SharePoint architect trying to connect business to
technology.
Believe in providing useful solutions to empower the users
as much as possible.
MCSD SharePoint 2010, MCSD ASP.NET 4.0
Contact Information



E-MAIL: Kunaal.Kapoor@BrightStarr.com
Twitter: @KunaalKapoor
Blog: http://geekswithblogs.net/kunaalkapoor/
Company Website: http://www.brightstarr.com/
Agenda

 What’s CSOM?
 What’s new with SharePoint 2013?
 REST, OData, OAuth
 CSOM – Tools and Libraries
 Questions & Feedback




*Session Duration: 1 hour (12:30 - 1:30 p.m.)
Agenda

What’s CSOM?
What’s new with SharePoint 2013?
REST, OData, OAuth
CSOM – Tools and Libraries
Questions & Feedback
What’s CSOM?
SharePoint has two frameworks for development:
     Server-side object model
     Used to run code on the server.
     Eg: WebParts, workflows, taxonomies and so on.

     Client-side object model (CSOM)
     Used to develop code that runs outside of
     the SharePoint server.
     Eg: Applications you have on your desktop, mobile etc.
What’s CSOM?
What’s CSOM?
Introduced in SharePoint 2010
Multiple implementations
Managed:
       .NET Framework
       & Silverlight
JavaScript
Agenda

What’s CSOM?
What’s new with SharePoint 2013?
REST, OData, OAuth
CSOM – Tools and Libraries
Questions & Feedback
CSOM - SharePoint 2013

Expanded significantly!

Increased coverage from CSOM in SharePoint
2010, Including:
Business Data
Search
User Profile & Feeds
Publishing
Taxonomy
Workflows

Minimal Download Strategy UX
Push for client side actions
CSOM - SharePoint 2013


Critical Part of the App Model.
     SharePoint apps cannot run any server-side
     code inside the SharePoint host environment.


Four permutations for writing code in
a SharePoint app:
     Client-side JavaScript that uses CSOM
     Client-side JavaScript that uses the REST API
     Server-side C# code that uses CSOM
     Server-side C# code that uses the REST API
CSOM - SharePoint 2013

SharePoint 2010                     SharePoint 2013




SharePoint 2010 doesn’t support     Client.svc service extended with
direct access to Client.svc         REST capabilities
Calls to the Client.svc should go   Client.svc accepts HTTP GET, PUT
through supported entry points      and POST requests
Supported entry points: .NET,       Implemented in accordance with
Silverlight & JavaScript            the OData Protocol
CSOM - SharePoint 2013
Agenda

What’s CSOM?
What’s new with SharePoint 2013?
REST, OData, OAuth
CSOM – APIs, Tools and Libraries
Questions & Feedback
REST, OData and OAuth

REST (Representational State Transfer) has a lot of
industry momentum.
It is a style of Software Architecture for distributed
systems.

For SharePoint 2013
      Nearly every API in the client object model
      has a corresponding REST endpoint.
REST, OData and OAuth

                           http://www.odata.org/


ODATA is the new data access API like ADO.

It standardizes data access APIs
Becoming really popular and used by Netflix, Azure
and other industry leaders
Supports formats like:
       Atom, JSON or plain XML
REST, Odata, OAuth


                               http://oauth.net

The OAuth is an open authorization framework.

It enables a application to obtain access to an
HTTP service.

It is meant to keep the authentication conflicts
to a minimum.
Agenda

What’s CSOM?
What’s new with SharePoint 2013?
REST, OData, OAuth
CSOM – Tools and Libraries
Questions & Feedback
CSOM –Tools & Libraries


JQuery
http://jquery.com

Fast, small, and feature-rich JavaScript library.
Easy-to-use API that works across a multitude of
browsers.
jQuery has changed the way that millions of
people write JavaScript

Library Size = 32KB (minified)
CSOM – Tools and Libraries


DataJS            http://datajs.codeplex.com
Cross-browser library for data driven applications.
Simplifies working with OData and JSON responses.
Library Size = 58KB (minified)

Knockout                http://knockoutjs.com
JS implementation of the MVVM pattern.
Declarative Bindings and Dependency Checking
Automatic UI refresh
Library Size = 40 KB (minified)
CSOM – Tools and Libraries

Visual Studio 2012
Developer tools include:
     Project Templates
     Item Templates
Designer & Tool Windows
Deployment & Debugging
CSOM – Tools and Libraries

Web Essentials 2012
   Visual Studio 2012 Extension in Online
   Gallery
   Additional IntelliSense for CSS3
   Warnings & Helpers for browser
   compatibility issues
   Selector IntelliSense for HTML
   elements, classes and IDs
CSOM – Tools and Libraries
Fiddler – Available free @ http://fiddler2.com




     HTTP debugging proxy
     Inspect and debug traffic from any client
     Tamper client requests and server responses
     Useful in debugging SharePoint: JavaScript/
     CSOM & REST based development
     Test the performance of your web sites & apps
CSOM – Tools and Libraries
Firebug – Available free @ http://getfirebug.com




HTTP debugging proxy
Inspect and debug traffic from any client
Tamper client requests and server responses
Useful in debugging SharePoint: JavaScript
CSOM & REST based development
Test the performance of your web sites & apps
Agenda

What’s CSOM?
What’s new with SharePoint 2013?
REST, OData, OAuth
CSOM – APIs, Tools and Libraries
Questions & Feedback
Resources & References

MSDN: http://blogs.msdn.com
CodePlex: http://codeplex.com
OAuth: http://oauth.net
OData: http://www.odata.org
Contact Information



E-MAIL: Kunaal.Kapoor@BrightStarr.com
Twitter: @KunaalKapoor
Blog: http://geekswithblogs.net/kunaalkapoor/
Company Website: http://www.brightstarr.com/
Please Leave Feedback During Q&A
If you leave session
feedback and
provide contact
information in the
survey, you will be
qualified for a book,
ebook or DVD
giveaway.

Scan the QR Code to
the right or go to
bit.ly/spshou42

                        29
Thanks to all our Sponsors!




            30

CSOM (Client Side Object Model). Explained @ SharePoint Saturday Houston

  • 1.
    Client Side ObjectModel (CSOM) - SharePoint 2013 KUNAAL KAPOOR 0
  • 2.
    Welcome to SharePointSaturday Houston Thank you for being a part of the 4th Annual SharePoint Saturday for the greater Houston area! • Please turn off all electronic devices or set them to vibrate. • If you must take a phone call, please do so in the hall so as not to disturb others. • Thanks to our Title Sponsor: 1
  • 3.
    Information • Speaker presentationslides will be available at bit.ly/GoSPSHOU within a week • The Houston SharePoint User Group will be having it’s next meeting Wednesday April 17th. Please join us at www.h-spug.org 2
  • 4.
    About Me KUNAAL KAPOOR VicePresident Delivery BrightStarr A SharePoint architect trying to connect business to technology. Believe in providing useful solutions to empower the users as much as possible. MCSD SharePoint 2010, MCSD ASP.NET 4.0
  • 5.
    Contact Information E-MAIL: Kunaal.Kapoor@BrightStarr.com Twitter:@KunaalKapoor Blog: http://geekswithblogs.net/kunaalkapoor/ Company Website: http://www.brightstarr.com/
  • 6.
    Agenda What’s CSOM? What’s new with SharePoint 2013? REST, OData, OAuth CSOM – Tools and Libraries Questions & Feedback *Session Duration: 1 hour (12:30 - 1:30 p.m.)
  • 7.
    Agenda What’s CSOM? What’s newwith SharePoint 2013? REST, OData, OAuth CSOM – Tools and Libraries Questions & Feedback
  • 8.
    What’s CSOM? SharePoint hastwo frameworks for development: Server-side object model Used to run code on the server. Eg: WebParts, workflows, taxonomies and so on. Client-side object model (CSOM) Used to develop code that runs outside of the SharePoint server. Eg: Applications you have on your desktop, mobile etc.
  • 9.
  • 10.
    What’s CSOM? Introduced inSharePoint 2010 Multiple implementations Managed: .NET Framework & Silverlight JavaScript
  • 11.
    Agenda What’s CSOM? What’s newwith SharePoint 2013? REST, OData, OAuth CSOM – Tools and Libraries Questions & Feedback
  • 12.
    CSOM - SharePoint2013 Expanded significantly! Increased coverage from CSOM in SharePoint 2010, Including: Business Data Search User Profile & Feeds Publishing Taxonomy Workflows Minimal Download Strategy UX Push for client side actions
  • 13.
    CSOM - SharePoint2013 Critical Part of the App Model. SharePoint apps cannot run any server-side code inside the SharePoint host environment. Four permutations for writing code in a SharePoint app: Client-side JavaScript that uses CSOM Client-side JavaScript that uses the REST API Server-side C# code that uses CSOM Server-side C# code that uses the REST API
  • 14.
    CSOM - SharePoint2013 SharePoint 2010 SharePoint 2013 SharePoint 2010 doesn’t support Client.svc service extended with direct access to Client.svc REST capabilities Calls to the Client.svc should go Client.svc accepts HTTP GET, PUT through supported entry points and POST requests Supported entry points: .NET, Implemented in accordance with Silverlight & JavaScript the OData Protocol
  • 15.
  • 16.
    Agenda What’s CSOM? What’s newwith SharePoint 2013? REST, OData, OAuth CSOM – APIs, Tools and Libraries Questions & Feedback
  • 17.
    REST, OData andOAuth REST (Representational State Transfer) has a lot of industry momentum. It is a style of Software Architecture for distributed systems. For SharePoint 2013 Nearly every API in the client object model has a corresponding REST endpoint.
  • 18.
    REST, OData andOAuth http://www.odata.org/ ODATA is the new data access API like ADO. It standardizes data access APIs Becoming really popular and used by Netflix, Azure and other industry leaders Supports formats like: Atom, JSON or plain XML
  • 19.
    REST, Odata, OAuth http://oauth.net The OAuth is an open authorization framework. It enables a application to obtain access to an HTTP service. It is meant to keep the authentication conflicts to a minimum.
  • 20.
    Agenda What’s CSOM? What’s newwith SharePoint 2013? REST, OData, OAuth CSOM – Tools and Libraries Questions & Feedback
  • 21.
    CSOM –Tools &Libraries JQuery http://jquery.com Fast, small, and feature-rich JavaScript library. Easy-to-use API that works across a multitude of browsers. jQuery has changed the way that millions of people write JavaScript Library Size = 32KB (minified)
  • 22.
    CSOM – Toolsand Libraries DataJS http://datajs.codeplex.com Cross-browser library for data driven applications. Simplifies working with OData and JSON responses. Library Size = 58KB (minified) Knockout http://knockoutjs.com JS implementation of the MVVM pattern. Declarative Bindings and Dependency Checking Automatic UI refresh Library Size = 40 KB (minified)
  • 23.
    CSOM – Toolsand Libraries Visual Studio 2012 Developer tools include: Project Templates Item Templates Designer & Tool Windows Deployment & Debugging
  • 24.
    CSOM – Toolsand Libraries Web Essentials 2012 Visual Studio 2012 Extension in Online Gallery Additional IntelliSense for CSS3 Warnings & Helpers for browser compatibility issues Selector IntelliSense for HTML elements, classes and IDs
  • 25.
    CSOM – Toolsand Libraries Fiddler – Available free @ http://fiddler2.com HTTP debugging proxy Inspect and debug traffic from any client Tamper client requests and server responses Useful in debugging SharePoint: JavaScript/ CSOM & REST based development Test the performance of your web sites & apps
  • 26.
    CSOM – Toolsand Libraries Firebug – Available free @ http://getfirebug.com HTTP debugging proxy Inspect and debug traffic from any client Tamper client requests and server responses Useful in debugging SharePoint: JavaScript CSOM & REST based development Test the performance of your web sites & apps
  • 27.
    Agenda What’s CSOM? What’s newwith SharePoint 2013? REST, OData, OAuth CSOM – APIs, Tools and Libraries Questions & Feedback
  • 28.
    Resources & References MSDN:http://blogs.msdn.com CodePlex: http://codeplex.com OAuth: http://oauth.net OData: http://www.odata.org
  • 29.
    Contact Information E-MAIL: Kunaal.Kapoor@BrightStarr.com Twitter:@KunaalKapoor Blog: http://geekswithblogs.net/kunaalkapoor/ Company Website: http://www.brightstarr.com/
  • 30.
    Please Leave FeedbackDuring Q&A If you leave session feedback and provide contact information in the survey, you will be qualified for a book, ebook or DVD giveaway. Scan the QR Code to the right or go to bit.ly/spshou42 29
  • 31.
    Thanks to allour Sponsors! 30