SlideShare a Scribd company logo
1 of 39
REST API and
                             Client Object
                             Model for
                             SharePoint
                             Developer
Ram Yadav
Sr Consultant
Microsoft Corp.
MCM : SharePoint 2007/2010
Agenda

 Overview  of accessing Data in SharePoint
 Client Object Model
    .NET Client Object Model
    JavaScript and Client Object Model
 REST   & WCF Data Services
First , How it was 2007 and what
we have now in 2010 for
Accessing Data in SharePoint
Accessing Data in 2007
Web Services
 Web services are available
 for use
   _vit_bin/Lists.asmx
   _vit_bin/Sites.asmx
   _vit_bin/Webs.asmx
   ….
   …..
Why Client OM
 Disadvantages   of Web Services
    Web Services can be complicated
    Difficult to call from JavaScript
    Often custom wrapper services are created
    Customers solve the same problem over and over
     again
Accessing Data in 2010
Accessing data using REST
Integrating with SharePoint
   Web Services
       More coverage                                       Web Services
                                                            Advanced Operations
                                                            SharePoint Server
   Client Object Model                                     Operations
       Site, navigation
       security services                                    Client OM
                                                             Advanced List
       Very flexible and straight forward                   Operations
                                                             Site Operations
   REST                                                     Security
       Easiest to use                                         REST
       For fixed list schema                                  Working with list
                                                               data,
                                                               fixed schema
 RPC
   http://msdn.microsoft.com/en-us/library/ms478653.aspx
   Server Side code , List View , Data View
How do I utilize client object model in my windows apps?

.NET Client object model
Getting Started: 3 things to know
1. ClientContext is the central object
  clientContext =
  new ClientContext(“http://mysite”);

2. Before you read a property, you have to
ask for it

  clientContext.Load(list);

3. All requests must be committed in a batch

  clientContext.ExecuteQuery();
Client Application            Server

     Sequence of              Client.svc
     commands:
     command 1;
     command 2;           Execute commands
     command 3;              in the batch:
context.ExecuteQuery();      command 1;
                             command 2;
                             command 3;
    Process results        Send results back
Equivalent Objects
Server       .NET Managed            Silverlight             JavaScript
(Microsoft   (Microsoft.SharePoint   (Microsoft.SharePoint   (SP.js)
.SharePoint) .Client)                .Client.Silverlight)

SPContext     ClientContext          ClientContext           ClientContext

SPSite        Site                   Site                    Site

SPWeb         Web                    Web                     Web

SPList        List                   List                    List

SPListItem    ListItem               ListItem                ListItem

SPField       Field                  Field                   Field

Member names mostly the same from server to client
(e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
.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
.NET Client OM Code Example 1
ClientContext clictx = new ClientContext("http://intranet.contoso.com");
        Site s1 = clictx.Site;
        Web w1 = clictx.Site.RootWeb;

       clictx.Load(s1);
       clictx.Load(w1);
       clictx.ExecuteQuery();

       var lists1 = clictx.LoadQuery(w1.Lists);
       clictx.ExecuteQuery();

       var lists2 = clictx.LoadQuery(w1.Lists.Include(l => l.Title));
       clictx.ExecuteQuery();

       var query1 = from l1 in w1.Lists where l1.Title != null select l1;
       clictx.ExecuteQuery();
Client Object Model
ClientContext ctx = new ClientContext(“http://mysite”);
       Web web = ctx.Site.RootWeb;
       ctx.Load(web);

       ctx.Load(web, w => w.Title, w => w.Description);

       ctx.Load(web, w => w.Title,
              w => w.Lists .Include(l => l.Fields
                     .Include(f => f.InternalName,
                                       f => f.Group)));
Uploading file example
Client Object Model
Authentication
      Uses Windows Authentication by default
      Can be configured for Claims Based Authentication

ctx.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
ctx.FormsAuthenticationLoginInfo = new
        FormsAuthenticationLoginInfo("loginName", "password");
Client Object Model Limitations

 You  still need to handle synch/update semantics
  (change log could help)
 No elevation of privilege capabilities
 Requests are throttled
 .net CLR has sync method;
  Silverlight CLR and Jscript are async
21



Demo
The JavaScript Client Object
Model
Equivalent Objects
Server       .NET Managed            Silverlight             JavaScript
(Microsoft   (Microsoft.SharePoint   (Microsoft.SharePoint   (SP.js)
.SharePoint) .Client)                .Client.Silverlight)

SPContext     ClientContext          ClientContext           ClientContext

SPSite        Site                   Site                    Site

SPWeb         Web                    Web                     Web

SPList        List                   List                    List

SPListItem    ListItem               ListItem                ListItem

SPField       Field                  Field                   Field

Member names mostly the same from server to client
(e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
JavaScript Client OM
 JavaScript
           Client OM is easily added to a SharePoint
  ASPX page - reference:
     _layouts/sp.js
     Add this using <SharePoint:ScriptLink>
 All   libraries crunched for performance
     Use un-crunched *.debug.js files with debug mode
 Method   signatures can be different compared to
  .NET and Silverlight
 Different data value types
JavaScript Client OM

 C:Program   FilesCommon
  FilesMicrosoft SharedWeb Server
  Extensions14TEMPLATELAYOUTS
 SP.js (SP.debug.js)
    380KB (559KB)
 SP.Core.js   (SP.Core.debug.js)
    13KB (20KB)
 SP.Runtime.js     (SP.Runtime.debug.js)
    68KB (108KB)
JavaScript Client OM
27




Java Script Client OM Demo
REST access to SharePoint data

REST & WCF Data Services
Why a RESTful Interface for SP?
 Why   REST
    It is a natural fit for SharePoint data
    Item == resource
    Uniform interface and addressing scheme
    Low barrier of entry, interoperability


 Why   WCF Data Services
    RESTful conventions & frameworks for data
    Builds on top of standard AtomPub
    Exactly the sort of convention we needed
    Consistent tools and client libraries
A RESTful Interface for Data
 Just   HTTP
     Items as resources, HTTP methods (GET, PUT, …) to act
     Leverage proxies, authentication, ETags, …
 Uniform    URL convention
     Every piece of information is addressable
     Predictable and flexible URL syntax
 Multiple   representations
     Use regular HTTP content-type negotiation
     JSON and Atom (full AtomPub support)
Accessing data using REST
Operations
 Operations    map to HTTP verbs
    Retrieve items/lists  GET
    Create new item  POST
    Update an item  PUT or MERGE
    Delete an item  DELETE
    These apply to links (lookups) as well


 SharePoint   rules apply during updates
    Validation, access control, etc.
URL Conventions
List of lists    …/_vti_bin/listdata.svc/
List             listdata.svc/Employees
Item          listdata.svc/Employees(123)
    Addressing lists and items
Single column listdata.svc/Employees(123)/Fullname
Lookup           listdata.svc/Employees(123)/Project
traversal
Raw value        listdata.svc/Employees(123)/Project/Title/$value
access


Sorting         listdata.svc/Employees?$orderby=Fullname
Filtering       listdata.svc/Employees?$filter=JobTitle eq 'SDE'
Projection      listdata.svc/Employees?$select=Fullname,JobTitle
Paging          listdata.svc/Employees?$top=10&$skip=30
Inline expansion listdata.svc/Employees?$expand=Project
34




REST Demo
Summary

 Overview  of accessing Data in SharePoint
 Client Object Model
    .NET Client Object Model
    JavaScript and Client Object Model
 REST   & WCF Data Services
Integrating with SharePoint
   Web Services
       More coverage                        Web Services
                                             Advanced Operations
                                             SharePoint Server
   Client Object Model                      Operations
       Site, navigation
       security services                     Client OM
                                              Advanced List
       Very flexible and straight forward    Operations
                                              Site Operations
                                              Security
   REST
       Easiest to use                          REST
                                                Working with list
       For fixed list schema
                                                data,
                                                fixed schema
 Server       Side OM
Accessing Data in 2010
Accessing data using REST
Rest API and Client OM for Developer

More Related Content

What's hot

Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST API
Eric Shupps
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
rahmed_sct
 
Windows Azure架构探析
Windows Azure架构探析Windows Azure架构探析
Windows Azure架构探析
George Ang
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
Roman Agaev
 
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data ServicesCreating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
sumedha.r
 
Introduction to share point 2010 development
Introduction to share point 2010 developmentIntroduction to share point 2010 development
Introduction to share point 2010 development
Eric Shupps
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
Phil Wicklund
 

What's hot (20)

Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
 
Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST API
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
 
SharePoint 2013 REST APIs
SharePoint 2013 REST APIsSharePoint 2013 REST APIs
SharePoint 2013 REST APIs
 
Windows Azure架构探析
Windows Azure架构探析Windows Azure架构探析
Windows Azure架构探析
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
 
SharePoint 2010 Client Object Model
SharePoint 2010 Client Object ModelSharePoint 2010 Client Object Model
SharePoint 2010 Client Object Model
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
 
Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST API
 
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data ServicesCreating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
 
Introduction to share point 2010 development
Introduction to share point 2010 developmentIntroduction to share point 2010 development
Introduction to share point 2010 development
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
 
Oracle World 2002 Leverage Web Services in E-Business Applications
Oracle World 2002 Leverage Web Services in E-Business ApplicationsOracle World 2002 Leverage Web Services in E-Business Applications
Oracle World 2002 Leverage Web Services in E-Business Applications
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
 

Viewers also liked

Viewers also liked (14)

تحلیل صنعت غذایی قسمت دوم
تحلیل صنعت غذایی قسمت دومتحلیل صنعت غذایی قسمت دوم
تحلیل صنعت غذایی قسمت دوم
 
INFORME SEGUNDO DEBATE SOLIDARIA RECONSTRUCCIÓN
INFORME SEGUNDO DEBATE SOLIDARIA RECONSTRUCCIÓN INFORME SEGUNDO DEBATE SOLIDARIA RECONSTRUCCIÓN
INFORME SEGUNDO DEBATE SOLIDARIA RECONSTRUCCIÓN
 
INFORME EJECUCIÓN PRESUPUESTARIA ENERO-JUNIO 2016
INFORME EJECUCIÓN PRESUPUESTARIA ENERO-JUNIO 2016INFORME EJECUCIÓN PRESUPUESTARIA ENERO-JUNIO 2016
INFORME EJECUCIÓN PRESUPUESTARIA ENERO-JUNIO 2016
 
STaR Chart
STaR ChartSTaR Chart
STaR Chart
 
6
66
6
 
Mapa Conceptual La Quiebra Danexis Pérez
Mapa Conceptual La Quiebra Danexis PérezMapa Conceptual La Quiebra Danexis Pérez
Mapa Conceptual La Quiebra Danexis Pérez
 
HERRAMIENTAS DE RECUPERACIÓN DE PLUSVALÍA. EXPERIENCIA LIMA
HERRAMIENTAS DE RECUPERACIÓN DE PLUSVALÍA. EXPERIENCIA LIMAHERRAMIENTAS DE RECUPERACIÓN DE PLUSVALÍA. EXPERIENCIA LIMA
HERRAMIENTAS DE RECUPERACIÓN DE PLUSVALÍA. EXPERIENCIA LIMA
 
Sucesoral trabajo actividad 1
Sucesoral trabajo actividad 1Sucesoral trabajo actividad 1
Sucesoral trabajo actividad 1
 
Taller dolarizacion
Taller dolarizacionTaller dolarizacion
Taller dolarizacion
 
Lumen Gentium
 Lumen Gentium Lumen Gentium
Lumen Gentium
 
COSTOS Y PRESUPUESTOS POR ORDENADOR
COSTOS Y PRESUPUESTOS POR ORDENADORCOSTOS Y PRESUPUESTOS POR ORDENADOR
COSTOS Y PRESUPUESTOS POR ORDENADOR
 
Adam Kuettel - 5 Fintech Companies Worth Paying Attention To
Adam Kuettel - 5 Fintech Companies Worth Paying Attention ToAdam Kuettel - 5 Fintech Companies Worth Paying Attention To
Adam Kuettel - 5 Fintech Companies Worth Paying Attention To
 
WALLS: A Manifesto For An Open Agency
WALLS: A Manifesto For An Open AgencyWALLS: A Manifesto For An Open Agency
WALLS: A Manifesto For An Open Agency
 
Containerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil EstesContainerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil Estes
 

Similar to Rest API and Client OM for Developer

Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010
Quang Nguyễn Bá
 
Time for a REST - .NET Framework v3.5 & RESTful Web Services
Time for a REST - .NET Framework v3.5 & RESTful Web ServicesTime for a REST - .NET Framework v3.5 & RESTful Web Services
Time for a REST - .NET Framework v3.5 & RESTful Web Services
ukdpe
 
Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)
Igor Moochnick
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
Darren Sim
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012
daniel plocker
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 
Developing for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data ServicesDeveloping for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data Services
Harish Ranganathan
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
ukdpe
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Model
maddinapudi
 

Similar to Rest API and Client OM for Developer (20)

Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
 
Time for a REST - .NET Framework v3.5 & RESTful Web Services
Time for a REST - .NET Framework v3.5 & RESTful Web ServicesTime for a REST - .NET Framework v3.5 & RESTful Web Services
Time for a REST - .NET Framework v3.5 & RESTful Web Services
 
Full Stack Developer
Full Stack DeveloperFull Stack Developer
Full Stack Developer
 
Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)
 
Developing With Data Technologies
Developing With Data TechnologiesDeveloping With Data Technologies
Developing With Data Technologies
 
RESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services FrameworkRESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services Framework
 
Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5
 
ADO.NET Data Services
ADO.NET Data ServicesADO.NET Data Services
ADO.NET Data Services
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
 
Introducing SQL Server Data Services
Introducing SQL Server Data ServicesIntroducing SQL Server Data Services
Introducing SQL Server Data Services
 
Introducing SQL Server Data Services
Introducing SQL Server Data ServicesIntroducing SQL Server Data Services
Introducing SQL Server Data Services
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Services
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
 
Developing for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data ServicesDeveloping for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data Services
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Model
 
Apps 101 - Moving to the SharePoint 2013 App Model - Presented 7/27/13 at Sha...
Apps 101 - Moving to the SharePoint 2013 App Model - Presented 7/27/13 at Sha...Apps 101 - Moving to the SharePoint 2013 App Model - Presented 7/27/13 at Sha...
Apps 101 - Moving to the SharePoint 2013 App Model - Presented 7/27/13 at Sha...
 

More from InnoTech

More from InnoTech (20)

"So you want to raise funding and build a team?"
"So you want to raise funding and build a team?""So you want to raise funding and build a team?"
"So you want to raise funding and build a team?"
 
Artificial Intelligence is Maturing
Artificial Intelligence is MaturingArtificial Intelligence is Maturing
Artificial Intelligence is Maturing
 
What is AI without Data?
What is AI without Data?What is AI without Data?
What is AI without Data?
 
Courageous Leadership - When it Matters Most
Courageous Leadership - When it Matters MostCourageous Leadership - When it Matters Most
Courageous Leadership - When it Matters Most
 
The Gathering Storm
The Gathering StormThe Gathering Storm
The Gathering Storm
 
Sql Server tips from the field
Sql Server tips from the fieldSql Server tips from the field
Sql Server tips from the field
 
Quantum Computing and its security implications
Quantum Computing and its security implicationsQuantum Computing and its security implications
Quantum Computing and its security implications
 
Converged Infrastructure
Converged InfrastructureConverged Infrastructure
Converged Infrastructure
 
Making the most out of collaboration with Office 365
Making the most out of collaboration with Office 365Making the most out of collaboration with Office 365
Making the most out of collaboration with Office 365
 
Blockchain use cases and case studies
Blockchain use cases and case studiesBlockchain use cases and case studies
Blockchain use cases and case studies
 
Blockchain: Exploring the Fundamentals and Promising Potential
Blockchain: Exploring the Fundamentals and Promising Potential Blockchain: Exploring the Fundamentals and Promising Potential
Blockchain: Exploring the Fundamentals and Promising Potential
 
Business leaders are engaging labor differently - Is your IT ready?
Business leaders are engaging labor differently - Is your IT ready?Business leaders are engaging labor differently - Is your IT ready?
Business leaders are engaging labor differently - Is your IT ready?
 
AI 3.0: Is it Finally Time for Artificial Intelligence and Sensor Networks to...
AI 3.0: Is it Finally Time for Artificial Intelligence and Sensor Networks to...AI 3.0: Is it Finally Time for Artificial Intelligence and Sensor Networks to...
AI 3.0: Is it Finally Time for Artificial Intelligence and Sensor Networks to...
 
Using Business Intelligence to Bring Your Data to Life
Using Business Intelligence to Bring Your Data to LifeUsing Business Intelligence to Bring Your Data to Life
Using Business Intelligence to Bring Your Data to Life
 
User requirements is a fallacy
User requirements is a fallacyUser requirements is a fallacy
User requirements is a fallacy
 
What I Wish I Knew Before I Signed that Contract - San Antonio
What I Wish I Knew Before I Signed that Contract - San Antonio What I Wish I Knew Before I Signed that Contract - San Antonio
What I Wish I Knew Before I Signed that Contract - San Antonio
 
Disaster Recovery Plan - Quorum
Disaster Recovery Plan - QuorumDisaster Recovery Plan - Quorum
Disaster Recovery Plan - Quorum
 
Share point saturday access services 2015 final 2
Share point saturday access services 2015 final 2Share point saturday access services 2015 final 2
Share point saturday access services 2015 final 2
 
Sp tech festdallas - office 365 groups - planner session
Sp tech festdallas - office 365 groups - planner sessionSp tech festdallas - office 365 groups - planner session
Sp tech festdallas - office 365 groups - planner session
 
Power apps presentation
Power apps presentationPower apps presentation
Power apps presentation
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Rest API and Client OM for Developer

  • 1. REST API and Client Object Model for SharePoint Developer Ram Yadav Sr Consultant Microsoft Corp. MCM : SharePoint 2007/2010
  • 2. Agenda  Overview of accessing Data in SharePoint  Client Object Model  .NET Client Object Model  JavaScript and Client Object Model  REST & WCF Data Services
  • 3. First , How it was 2007 and what we have now in 2010 for Accessing Data in SharePoint
  • 5. Web Services Web services are available for use _vit_bin/Lists.asmx _vit_bin/Sites.asmx _vit_bin/Webs.asmx …. …..
  • 6. Why Client OM  Disadvantages of Web Services  Web Services can be complicated  Difficult to call from JavaScript  Often custom wrapper services are created  Customers solve the same problem over and over again
  • 8.
  • 10. Integrating with SharePoint  Web Services  More coverage Web Services Advanced Operations SharePoint Server  Client Object Model Operations  Site, navigation  security services Client OM Advanced List  Very flexible and straight forward Operations Site Operations  REST Security  Easiest to use REST  For fixed list schema Working with list data, fixed schema  RPC  http://msdn.microsoft.com/en-us/library/ms478653.aspx  Server Side code , List View , Data View
  • 11. How do I utilize client object model in my windows apps? .NET Client object model
  • 12. Getting Started: 3 things to know 1. ClientContext is the central object clientContext = new ClientContext(“http://mysite”); 2. Before you read a property, you have to ask for it clientContext.Load(list); 3. All requests must be committed in a batch clientContext.ExecuteQuery();
  • 13. Client Application Server Sequence of Client.svc commands: command 1; command 2; Execute commands command 3; in the batch: context.ExecuteQuery(); command 1; command 2; command 3; Process results Send results back
  • 14. Equivalent Objects Server .NET Managed Silverlight JavaScript (Microsoft (Microsoft.SharePoint (Microsoft.SharePoint (SP.js) .SharePoint) .Client) .Client.Silverlight) SPContext ClientContext ClientContext ClientContext SPSite Site Site Site SPWeb Web Web Web SPList List List List SPListItem ListItem ListItem ListItem SPField Field Field Field Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
  • 15. .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
  • 16. .NET Client OM Code Example 1 ClientContext clictx = new ClientContext("http://intranet.contoso.com"); Site s1 = clictx.Site; Web w1 = clictx.Site.RootWeb; clictx.Load(s1); clictx.Load(w1); clictx.ExecuteQuery(); var lists1 = clictx.LoadQuery(w1.Lists); clictx.ExecuteQuery(); var lists2 = clictx.LoadQuery(w1.Lists.Include(l => l.Title)); clictx.ExecuteQuery(); var query1 = from l1 in w1.Lists where l1.Title != null select l1; clictx.ExecuteQuery();
  • 17. Client Object Model ClientContext ctx = new ClientContext(“http://mysite”); Web web = ctx.Site.RootWeb; ctx.Load(web); ctx.Load(web, w => w.Title, w => w.Description); ctx.Load(web, w => w.Title, w => w.Lists .Include(l => l.Fields .Include(f => f.InternalName, f => f.Group)));
  • 19. Client Object Model Authentication Uses Windows Authentication by default Can be configured for Claims Based Authentication ctx.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; ctx.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("loginName", "password");
  • 20. Client Object Model Limitations  You still need to handle synch/update semantics (change log could help)  No elevation of privilege capabilities  Requests are throttled  .net CLR has sync method; Silverlight CLR and Jscript are async
  • 22. The JavaScript Client Object Model
  • 23. Equivalent Objects Server .NET Managed Silverlight JavaScript (Microsoft (Microsoft.SharePoint (Microsoft.SharePoint (SP.js) .SharePoint) .Client) .Client.Silverlight) SPContext ClientContext ClientContext ClientContext SPSite Site Site Site SPWeb Web Web Web SPList List List List SPListItem ListItem ListItem ListItem SPField Field Field Field Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
  • 24. JavaScript Client OM  JavaScript Client OM is easily added to a SharePoint ASPX page - reference:  _layouts/sp.js  Add this using <SharePoint:ScriptLink>  All libraries crunched for performance  Use un-crunched *.debug.js files with debug mode  Method signatures can be different compared to .NET and Silverlight  Different data value types
  • 25. JavaScript Client OM  C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS  SP.js (SP.debug.js)  380KB (559KB)  SP.Core.js (SP.Core.debug.js)  13KB (20KB)  SP.Runtime.js (SP.Runtime.debug.js)  68KB (108KB)
  • 28. REST access to SharePoint data REST & WCF Data Services
  • 29. Why a RESTful Interface for SP?  Why REST  It is a natural fit for SharePoint data  Item == resource  Uniform interface and addressing scheme  Low barrier of entry, interoperability  Why WCF Data Services  RESTful conventions & frameworks for data  Builds on top of standard AtomPub  Exactly the sort of convention we needed  Consistent tools and client libraries
  • 30. A RESTful Interface for Data  Just HTTP  Items as resources, HTTP methods (GET, PUT, …) to act  Leverage proxies, authentication, ETags, …  Uniform URL convention  Every piece of information is addressable  Predictable and flexible URL syntax  Multiple representations  Use regular HTTP content-type negotiation  JSON and Atom (full AtomPub support)
  • 32. Operations  Operations map to HTTP verbs  Retrieve items/lists  GET  Create new item  POST  Update an item  PUT or MERGE  Delete an item  DELETE  These apply to links (lookups) as well  SharePoint rules apply during updates  Validation, access control, etc.
  • 33. URL Conventions List of lists …/_vti_bin/listdata.svc/ List listdata.svc/Employees Item listdata.svc/Employees(123)  Addressing lists and items Single column listdata.svc/Employees(123)/Fullname Lookup listdata.svc/Employees(123)/Project traversal Raw value listdata.svc/Employees(123)/Project/Title/$value access Sorting listdata.svc/Employees?$orderby=Fullname Filtering listdata.svc/Employees?$filter=JobTitle eq 'SDE' Projection listdata.svc/Employees?$select=Fullname,JobTitle Paging listdata.svc/Employees?$top=10&$skip=30 Inline expansion listdata.svc/Employees?$expand=Project
  • 35. Summary  Overview of accessing Data in SharePoint  Client Object Model  .NET Client Object Model  JavaScript and Client Object Model  REST & WCF Data Services
  • 36. Integrating with SharePoint  Web Services  More coverage Web Services Advanced Operations SharePoint Server  Client Object Model Operations  Site, navigation  security services Client OM Advanced List  Very flexible and straight forward Operations Site Operations Security  REST  Easiest to use REST Working with list  For fixed list schema data, fixed schema  Server Side OM

Editor's Notes

  1. ryadav@microsoft.com
  2. http://msdn.microsoft.com/en-us/library/ee857094.aspxhttp://msdn.microsoft.com/en-us/library/hh185006
  3. listdata.svc/Employees?$orderby=Fullnamelistdata.svc/Employees?$filter=JobTitleeq &apos;SDE&apos;listdata.svc/Employees?$select=Fullname,JobTitlelistdata.svc/Employees?$top=10&amp;$skip=30listdata.svc/Employees?$expand=Project