sharepoint 2010 data provider l.
Skip this Video
Loading SlideShow in 5 Seconds..
SharePoint 2010 : Data Provider PowerPoint Presentation
Download Presentation
SharePoint 2010 : Data Provider

Loading in 2 Seconds...

play fullscreen
1 / 36

SharePoint 2010 : Data Provider - PowerPoint PPT Presentation

Download Presentation
SharePoint 2010 : Data Provider
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. SharePoint 2010 : Data Provider The New way to connect data in SharePoint 2010 Renaud Comte [MVP]

  2. Wygwam Paris Wygwam Nord Wygwam Belux Wygwam Suisse

  3. Session Objectives: • Overview of Data Technologies • Discover each SharePoint data access technology • Present the new List Platform capabilities • Demonstrate how to interact with SharePoint data using the new SharePoint APIs

  4. Overview of Data Technologies REST APIs Strongly-typed ClientOM Weakly-typed Client-side Data Platform Farm Site List Data External Lists ServerOM Server-side Weakly-typed LINQ Strongly-typed New in 2010 Improved

  5. List Data Improvements in SharePoint 2010 List & Relationnal

  6. Lookups form relationships between lists One-to-many Many-to-many Lists and Lookups Projects Employees Clients Lookup Lookup m 1 m 1

  7. List Relationships • Enforce Data Integrity • One-to-many relationships can be used to: • Trigger cascade delete • Restrict delete • Relationship behaviors (delete/restrict) are not supported on multi-value lookups

  8. Large Lists • Set a limitfor how many rows of data can be retrieved for query before execution • List View Threshold • List View Threshold for Auditors and Administrators • List View Lookup Threshold • Daily Time Window for Large Queries • If enabled on the Web Application, developer can turn off throttling using: • SPQuery.RequestThrottleOverride • SPSiteDataQuery.RequestThrottleOverride

  9. DEMO List Data Model by Code Lookup to Multiple Columns List Relationships Related Items UI

  10. Query with the Server OM (and the Client OM) CAML is still here

  11. Data engine query still use CAML Just for query ! Become relationnal CAML Queries 2010 - Main Changes

  12. DEMO CAML 2010 in fact Lookup to Multiple Columns List Relationships Related Items UI

  13. Linq for SharePoint aka SPLINQ

  14. Entity based programming on the server SPMetal Code Generation Utility LINQ Queries Strong Types Translates LINQ queries into CAMLqueries Can be used in Web Parts, Event Receivers, Sandboxed code(Server OM only) Linq for SharePoint aka SPLINQ

  15. LINQ to SharePoint Basics spmetal.exe SPLinq.cs SPLinq.vb spmetal/web:http://dataetch/code:SPLinq.cs SharePoint Site http://SPsomewhere SPLinqDataContext • SPLinqDataContext dc = new SPLinqDataContext (“http://SPsomewhere”); • var q=dc.Employees.Where(emp=>emp.DueDate < DateTime.Now.AddMonths(6)); • from o in data.Orderswhere o.Customer.City.Name == “San Francisco“select o;

  16. Some details : Supports List Joins and Projections LINQ (lambda expressions, anonymous types, joins ...) can be used accross SharePoint lists Manage also Create/Update/Read/Delete operation Only "efficient" queries are supported by SPLINQ Beta 2. must be completed via LINQ to objects Change conflicts handling ... Linq for SharePoint aka SPLINQ

  17. DEMO SPLINQ live Simple Query Join Query Data CRUD and relational Sync management

  18. from p indata.Projectswhere p.Client.City == "Chicago"select new { Name = p.Title, ClientName = p.Client.Title, Budget = p.BudgetHours } LINQ to SharePointSample: Original LINQ query

  19. <Query> <Where> <And> <BeginsWith> <FieldRefName="ContentTypeId" /> <ValueType="ContentTypeId">0x0100</Value> </BeginsWith> <Eq> <FieldRefName="ClientCity" /> <ValueType="Lookup">Chicago</Value> </Eq> </And> </Where> </Query> <ViewFields> <FieldRefName="Title" /> <FieldRefName="ClientTitle" /> <FieldRefName="BudgetHours" /> </ViewFields> <ProjectedFields> <FieldName="ClientTitle" Type="Lookup" List="Client" ShowField="Title" /> <FieldName="ClientCity" Type="Lookup" List="Client" ShowField="City" /> </ProjectedFields> <Joins> <JoinType="LEFT" ListAlias="Client"> <!--List Name: Clients--> <Eq> <FieldRefName="Client" RefType="ID" /> <FieldRefList="Client" Name="ID" /> </Eq> </Join> </Joins> LINQ to SharePointGenerated CAML Query

  20. Client Object Model JS/SL/Win OM

  21. Unified object model across all clients JavaScript,.NETCLR,SilverlightCLR Subset of Server OM Webs, Lists, ListItems,Content Types, Fields,etc. Client Object Model

  22. Client OMGenerally How It Works Client Application Server Sequence of commands: Client.svc command 1; command 2; command 3; Execute commands in the batch: XML command 1; command 2; command 3; context.ExecuteQuery(); JSON Process results Send results back • Proxy to WCF • XML query / JSON response

  23. Client Object Model : Pattern • Create a Client Connection • Create a Client Connection • Execute the Query ClientContextclientContext = new ClientContext("http://SPdata"); List list = clientContext.Web.Lists.GetByTitle(“Projects"); clientContext.Load(list); clientContext.ExecuteQuery();

  24. Not an another OM !!! Simple API Server OM like ! It gives you Effienciency,Batch processing,Productivity,... Still need Context to load / Batch to execute CAML to query data ... Client Object Model : remarks

  25. RESTful Data ServiceInterface Odata is coming

  26. Work with data via Representational State Transfer (REST) Rss/Atom like : http://<site>/_vti_bin/ListData.svc SharePoint List Data Other Datasources Excel Services, Azure Cloud, ... Powered byWCF Data Services (ADO.NET Data Services v1.5 CTP2) Entity based programming Strong Types LINQ Queries REST API

  27. Framework free 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 Easy to use, not too much technology dependency Good for client side developpement Just a new protocol (Atom like) Open to any another technology Data/Url Driven Full Integration with Visual Studio

  28. REST APIsQueryString Parameters • $filter={simple predicate} • $expand={Entity} • $orderby={property} • $skip=n • $top=n • $metadata • See:

  29. REST APIsURI Map - Entity Properties • Syntax: • /_vti_bin/ListData.svc/{Entity}[({identifier})]/[{Property}] • Example to get budget hours for Project #4: • /_vit_bin/ListData.svc/Projects(4)/BudgetHours

  30. REST APIsURI Map Filter • Syntax: • /_vti_bin/ListData.svc/{Entity}?$filter={simple predicate} • Example to get Projects for Clients in Geneva: • /_vit_bin/ListData.svc/Projects?$filter=Client/City eq ‘Geneva'

  31. REST APIsURI Map – Expand (think Join) • Syntax: • /_vti_bin/ListData.svc/{Entity}?$expand={Entity} • Example to get a Project and its related Client: • /_vit_bin/ListData.svc/Projects?$expand=Client

  32. DEMO REST now … From a real simple client side code : jquery to ...

  33. Data Access TechnologiesDecision Matrix

  34. SharePoint 2010 List Data Model Relationships, Joins, and Data Integrity Caml is still here but Linq also Client OM and Server OM Complete set of data APIs on both server and client side REST APIs and LINQ to SharePoint Simple and integrated developer experience for list based Data Applications Of course : SP2010 Data coding To sum up

  35. Thank you for your Attention! • For more Information please contact • Name : Renaud Comte • Title : SharePoint Team Leader • Email :