• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

SharePoint 2013 REST and CSOM

on

  • 1,229 views

SharePoint Saturday Abu Dhabi

SharePoint Saturday Abu Dhabi

Statistics

Views

Total Views
1,229
Views on SlideShare
1,229
Embed Views
0

Actions

Likes
0
Downloads
49
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • The REST architectural style was developin parallel with HTTP/1.1, based on the existing design of HTTP/1.0.[6] The World Wide Web represents the largest implementation of a system conforming to the REST architectural style. REST exemplifies how the Web's architecture emerged by characterizing and constraining the macro-interactions of the four components of the Web, namely origin servers, gateways, proxies and clients, without imposing limitations on the individual participants. As such, REST essentially governs the proper behavior of participants.REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource can be essentially any coherent and meaningful concept that may be addressed. A representation of a resource is typically a document that captures the current or intended state of a resource.The client begins sending requests when it is ready to make the transition to a new state. While one or more requests are outstanding, the client is considered in transition. The representation of each application state contains links that may be used the next time the client chooses to initiate a new state-transition.[7]REST facilitates the transaction between web servers by allowing loose coupling between different services. REST is less strongly typed than its counterpart, SOAP. The REST language uses nouns and verbs, and has an emphasis on readability. Unlike SOAP, REST does not require XML parsing and does not require a message header to and from a service provider. This ultimately uses less bandwidth. REST error-handling also differs from that used by SOAP.REST is a set of principles that define how Web standards, such as HTTP and URIs, are supposed to be used (which often differs quite a bit from what many people actually do). The promise is that if you adhere to REST principles while designing your application, you will end up with a system that exploits the Web’s architecture to your benefit. In summary, the five key principles are:Give every “thing” an IDLink things togetherUse standard methodsResources with multiple representationsCommunicate statelesslyhttp://www.infoq.com/articles/rest-introduction
  • Everthing was client.SVC Web Service in SharePoint 2010.You need a proxy to read from client.svc. The proxy will take the code segments that we have and execute the equal server side code. We only had Managed Client,
  • However, SharePoint 2013 adds the ability for you to remotely interact with SharePoint sites by using REST. Now, you can interact directly with SharePoint artifacts by using any technology that supports standard REST capabilities.To use the REST capabilities that are built into SharePoint 2013, you construct a RESTful HTTP request, using the Open Data Protocol (OData) standard, which corresponds to the desired client object model API. The client.svc web service handles the HTTP request and serves the appropriate response in either Atom or JSON (JavaScript Object Notation) format. The client application must then parse that response. Figure 2 shows a high-level view of the SharePoint REST architecture.
  • The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years.  OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.OData is consistent with the way the Web works - it makes a deep commitment to URIs for resource identification and commits to an HTTP-based, uniform interface for interacting with those resources (just like the Web).   This commitment to core Web principles allows OData to enable a new level of data integration and interoperability across a broad range of clients, servers, services, and tools.http://odata.netflix.com/Catalog/Titles?$filter=ReleaseYear gt 2012&AverageRating gt 4
  • One of the majorimproviements has been made that that client.svc has been extended to provide direct support for client.svc. Now you can call client.svc using REST calls. Means you can now do stuff to SharePoint from non Microsoft Platform using the HTTP Get, Post request. Client.svc has now been implemented to cover not all but many of the oData specification which you can check from www.odata.org. Please note that not all the methods or calls are supported. You can check these details from http://msdn.microsoft.com/en-us/library/fp142385.aspxOn the other side there are great improvements in Server Side API of Client Object Model which gives us access to more information from SharePoint as well as a API that allow access to SharePoint from Windows Phone.
  • The browser is going to return the data in Atom-Pub. Which return data in XML which is self describing.Everything OdataServie scan also return JSON. Javascript Object Notation.
  • http://blogs.msdn.com/b/sharepointdev/archive/2011/07/25/working-with-the-ecmascript-client-object-model-jsom-in-sharepoint-2010-part-1-nikhil-sachdeva.aspxhttp://blogs.msdn.com/b/sharepointdev/archive/2011/07/25/working-with-the-ecmascript-client-object-model-jsom-in-sharepoint-2010-part-2-nikhil-sachdeva.aspxhttp://blogs.msdn.com/b/sharepointdev/archive/2011/07/19/working-with-the-ecmascript-client-object-model-jsom-in-sharepoint-2010-part-3-nikhil-sachdeva.aspxhttp://blogs.msdn.com/b/sharepointdev/archive/2011/07/25/working-with-the-ecmascript-client-object-model-jsom-in-sharepoint-2010-part-4-nikhil-sachdeva.aspx

SharePoint 2013 REST  and CSOM SharePoint 2013 REST and CSOM Presentation Transcript

  • Usama Wahab Khan Solution Architect ,Microsoft Technical Community Leader, Microsoft Certified Trained,MCPD,MCTS,MCTIP. For SharePoint and .NET /Azure Vice -President, Technology Middle east and Europe (DAVIGOLD LLC) ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Dcfk2012 password for wifi ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • http://uaesharepoint.org/ •Dev Saturday UAE •AUC Technologies User Group (AUCTUG) User Groups ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Agenda • OVERVIEW NEW API SHAREPOINT • CSOM JSOM INTRODUCTION • REST IMPROVEMENT • DEMO • New tools • Summary ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • SharePoint 2013 APIs Improvements · · · · · · More Web Standards (Odata,Oauth) More Client Side Support Improved Rest Model and EndPoint Odata URL base Query Engine OAuth Web base identity system. Mobile Templates. ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • SharePoint 2013 APIs Improvements By Features Feature .NET Framework or Silverlight object models JavaScript object model REST/OData endpoints called from a Windows platform or JavaScript Object-oriented programming Yes Yes No Batch processing Yes Yes No APIs for conditional processing and exception Yes handling No No Availability of LINQ syntax Yes No No Combining list data from different SharePoint web applications Yes No Yes Familiarity to experienced REST/OData developers No No Yes Similarity to non-Windows programming or JavaScript programming No Yes Yes Strong typing for list item fields No (except with LINQ) No Yes, from Windows platform No, from JavaScript Leveraging jQuery, Knockout, and other JavaScript libraries No ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • The device on which the code runs. ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Preview us CSOM Everything WAS client.svc Issues with CSOM • No Direct Access to client.svc Web Service • Must use a Proxy or Supported End Points • Supports .NET Silverlight & JavaScript ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • 2010 CSOM ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • SharePoint 2013 CSOM ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • x Changes in SharePoint 2013 Client.svc with REST Clients • Direct Access to client.svc Web Service • Access HTTP GET, PUT, Merge, POST Requests • OData Implementation • Writing Code from NON Microsoft Apps • New APIs for Server Functionality • API for Windows Phone Development For More Information http://tinyurl.com/SP2013Odata ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • New CSOM API Support User Profiles Sharing Search Taxonom y Workflow EDiscovery Feeds IRM Support both Server Side code and REST ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012. Publishin g Lists Analytics Business Data
  • SharePoint 2013 CSOM Architecture _api Server Client Execute Query .NET CLR Library Silverlight C Library JavaScript Library Custom Client Code ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012. OData
  • Changes in SharePoint 2013 CSOM • Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.RunTime.dll • Available in SharePoint Foundation • contains the core classes ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Demo Managed Client OM ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Demo JavaScript Client OM ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • What’s REST and Why? Simple and Easier to Use • Easier than SOAP Based WS’s • Higher Productivity using JavaScript and JQuery • Results as JSON and ATOM ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012. • Everything is URL • Results can be cached on Proxy Servers.
  • REST in SharePoint 2010 ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • REST in SharePoint 2013 Replace • http://intranet/_vti_bin/client.svc/web with • http://intranet/_api/web/ • Lot more simple URL • Helps in 256 Character Limit of URLs in browser • ListData.svc is still there for backword compatiability • OLD Aps will still work but needs to be updated ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Client OM and OData ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • What is OData? More Information @ http://www.odata.org/ ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • OData Implementation Details OData Maps CRUD Operations to HTTP Verbs Methods will be mapped into either More Information @ http://www.odata.org/ ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • URLs Resource Path – SQL Table or Web or List ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • REST – Return ATOM XML vs. JSON ATOM-PUB XML • Verbose • Easier to Read • ACCEPT = application/atom+xml • Condensed notation • Smaller payload • ACCEPT = application/json;odata=verbose; ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Managing Objects to Resources http://Intranet.consoto.com/_api/web/ http://Intranet.consoto.com/_api/web/Lists http://Intranet.consoto.com/_api/web/Lists/ http://Intranet.consoto.com/_api/web/getAvailableWebTem plates(lcid=1033 http://Intranet.consoto.com/_api/web/ http://intranet.consoto.com/_api/web/Lists/getByTitle(‘Cust omers’)/Items(0)/?$select ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Summary CSOM Now Covers More Important for App Development REST Improved Syntax Easy to Use with JavaScript than C# ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.
  • Some Great Resources http://msdn.microsoft.com/en-us/library/jj164060.aspx http://msdn.microsoft.com/en-us/library/jj163201.aspx http://msdn.microsoft.com/en-us/library/jj164022.aspx http://msdn.microsoft.com/en-us/library/jj163800.aspx http://msdn.microsoft.com/en-us/library/fp142385.aspx http://msdn.microsoft.com/en-us/library/fp142380.aspx http://msdn.microsoft.com/en-us/library/fp142386.aspx http://msdn.microsoft.com/enus/library/jj193034(v=office.15).aspx http://code.msdn.microsoft.com/office/SharePoint-2013Perform-a-1bf3e87d/view/SourceCode#content http://msdn.microsoft.com/en-us/library/jj860569.aspx ©2012 Microsoft Corporation. All rights reserved. Content based on SharePoint 15 Technical Preview and published July 2012.