Hilton Giesenow - The MOSS Show Developing with LINQ, REST & the New Client OM in Microsoft SharePoint 2010 SESSION CODE: OFC322.

Slides:



Advertisements
Similar presentations
The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Advertisements

Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module D (Office 2007 Version) Decision Analysis.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
Myra Shields Training Manager Introduction to OvidSP.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination. Introduction to the Business.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Microsoft Access 2007 Advanced Level. © Cheltenham Courseware Pty. Ltd. Slide No 2 Forms Customisation.
Custom Statutory Programs Chapter 3. Customary Statutory Programs and Titles 3-2 Objectives Add Local Statutory Programs Create Customer Application For.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Services Course Office Web Apps Participant Guide.
SharePoint 2010 Client Side Object Model. Agenda Introduction The Problem Client side vs Server Side Client Side Object Model – How it works – What can.
Paul Schaeflein, MCT Manager of Advanced Technologies LaSalle Consulting Partners, Inc. SESSION CODE: OSP309.
22 мая 2013, Киев Построение Windows 8 приложений для доступа к SharePoint 2013 Бельский Сергей.
PP Test Review Sections 6-1 to 6-6
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
Access Tables 1. Creating a Table Design View Define each field and its properties Data Sheet View Essentially spreadsheet Enter fields You must go to.
Bellwork Do the following problem on a ½ sheet of paper and turn in.
XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)
William Cornwill SharePoint Technical Specialist Microsoft Australia Microsoft Office System SharePoint 2007 Customising the Document Information Panel.
2 |SharePoint Saturday New York City
KETTŐŐ + EGY Comming Soon Comming Soon.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Faith Allington Program Manager Microsoft Corporation WSV322.
Services Course Outlook Live Participant Guide.
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
4 Oracle Data Integrator First Project – Simple Transformations: One source, one target 3-1.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
Services Course Windows Live SkyDrive Participant Guide.
Deep Dive into LINQ Eran Sharabi.NET Development Team Leader JohnBryce Training
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
Analyzing Genes and Genomes
Essential Cell Biology
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Hilton Giesenow - The MOSS Show Overview of the SharePoint 2010 Developer Platform SESSION CODE: OFC308.
Session 1.
Rich Platform Services Manageability User Experience.
1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd
Windows Azure SQL Data Sync Name Title Microsoft Corporation.
Joel Pobar Language Geek Microsoft DEV320 Improve on C# % Backwards Compatible Language Integrated Query (LINQ)
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
Course Agenda Deep Dive into the Building Blocks and Services of the SharePoint Platform Module 1: Developing Advanced Workflow Scenarios in Office 365.
6/19/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Customize Office 365 Search and create result sources
Office 365 Development.
Developer Patterns to Integrate Silverlight 4.0 with SharePoint 2010
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
SharePoint & jQuery: Better Together
SharePoint data access and LINQ to SharePoint
Tech Ed North America /1/ :36 AM Required Slide
Pablo Castro Software Architect Microsoft Corporation
Mike Ammerlaan Program Manager Microsoft Corporation
Maxim Lukiyanov Program Manager Microsoft Corporation
Creating and Consuming OData Services for Business Applications
Building RESTful services using OData
Office 365 Development.
Presentation transcript:

Hilton Giesenow - The MOSS Show Developing with LINQ, REST & the New Client OM in Microsoft SharePoint 2010 SESSION CODE: OFC322

3 Agenda Accessing SharePoint data – then & now List data model improvements in 2010 LINQ To SharePoint Client Object Model REST Special thanks to…

4 Accessing SharePoint Data – circa 2007 Server Object Model Weakly typed Lots of XML Long-winded Non-standard Non-relational Garbage collection Web Services Weakly typed TONS of XML Long-winded Non-standard Non-relational No WCF Non standards-compliant No flexibility

5 Overview of Data Technologies LINQLINQ Data Platform Farm Site List Data External Lists Server OM Client OM REST APIs Web Web Services

6 The Case Study - List Lookups Lookups form relationships between lists One-to-many Many-to-many Restrict / Cascade Deletes

7 List Data Model - Lists Joins and Projections Query within and across lists: Join lists using lookup columns Lookup to multiple columns Query Result Set

8 Take Note: List Validation and Uniqueness Excel-like validation formula Can be specified on Columns and Lists Example: =[Discount] < [Cost] Column uniqueness constraint

9 Take Note: Query Throttling Check query before execution No index and count > limit Joins > limit Can turn throttling off using SPQuery.RequestThrottleOverride SPSiteDataQuery.RequestThrottleOverride

10 Relationships Multi-Value Lookups Data Integrity & Data Validation Query Throttling

11 Querying SharePoint, circa

12 And the Code to Get There… SPQuery query = new SPQuery(); StringBuilder sbQuery = new StringBuilder(); sbQuery.Append(" "); sbQuery.Append(" "); sbQuery.Append(" "); sbQuery.Append(" " + field Value1 + " "); sbQuery.Append(" "); sbQuery.Append(" "); query.Query = sbQuery.ToString();

13 Joins in CAML 0x0100 Durban <Field Name="ClientTitle" Type="Lookup" List="Client" ShowField="Title" /> <Field Name="ClientCity" Type="Lookup" List="Client" ShowField="City" />

14 And the Code to Get There… using (SPSite site = new SPSite(SPContext.Current.Site)) { SPWeb web = site.RootWeb; if (web != null) { SPList list = web.Lists["Parents"]; if (list != null) { SPQuery query = new SPQuery(); StringBuilder sbQuery = new StringBuilder(); sbQuery.Append(" "); sbQuery.Append(" My Other Child "); sbQuery.Append(" "); query.Query = sbQuery.ToString(); StringBuilder sbJoins = new StringBuilder(); sbJoins.Append(" "); query.Joins = sbJoins.ToString(); StringBuilder sbProj = new StringBuilder(); sbProj.Append(" "); query.ProjectedFields = sbProj.ToString(); StringBuilder sbView = new StringBuilder(); sbView.Append(" "); query.ViewFields = sbView.ToString(); if (!string.IsNullOrEmpty(query.Query)) { SPListItemCollection matches = list.GetItems(query); foreach (SPListItem match in matches) { Console.WriteLine(match["Title"]); string rawNickname = (string)match["OtherChildrenNickname"]; if (!string.IsNullOrEmpty(rawNickname)) { SPFieldLookupValue nickname = new SPFieldLookupValue(rawNickname); Console.WriteLine(nickname.LookupValue); }

15 Overview of Data Technologies LINQLINQ Data Platform Farm Site List Data External Lists Server OM Client OM REST APIs Web Web Services

16 LINQ var CommonWords = from w in wordOccurances from w in wordOccurances where w.Count > 2 where w.Count > 2 select new { f.Name, w.Word, W.Count }; select new { f.Name, w.Word, W.Count }; var CommonWords = wordOccurances wordOccurances.Where(w => w.Count > 2).Where(w => w.Count > 2).Select(w => new {f.Name, w.Word, W.Count });.Select(w => new {f.Name, w.Word, W.Count }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference

17 LinQ to…

18 Objects XML.NET Language Integrated Query C# 3.0 VB 9.0 Others… Relational LINQ to Objects LINQ to SQL LINQ to XML LINQ to Entities LINQ Architecture LINQ to SharePoint SharePoint (CAML)

19 LINQ to SQL from p in dataContext.Projects where p.Client.City == Durban" select new { Name = p.Title, ClientName = p.Client.Title, Budget = p.BudgetHours };

20 LINQ to SQL – It's Just SQL Underneath SELECT [t0].[Title] AS [Name], [t1].[Title] AS [ClientName], [t0].[BudgetHours] AS [Budget] FROM [dbo].[Projects] AS [t0] INNER JOIN [dbo].[Clients] AS [t1] ON [t1].[ID] = [t0].[ClientID] WHERE [t1].[City] = 'Durban'

21 LINQ to SharePoint from p in dataContext.Projects where p.Client.City == Durban" select new { Name = p.Title, ClientName = p.Client.Title, Budget = p.BudgetHours };

22 LINQ to SharePoint – It's Just CAML Underneath 0x0100 Durban <Field Name="ClientTitle" Type="Lookup" List="Client" ShowField="Title" /> <Field Name="ClientCity" Type="Lookup" List="Client" ShowField="City" />

23 Accessing Relational SharePoint Data using LINQ to SharePoint

24 LINQ to SharePoint – Some Limitations Unsupported Queries & Limits E.g. unsupported JOINS Join Limits - MS recommends < 8 Query Throttling 2-stage queries E.g. Aggregate, Distinct, Max, Min, Sum, SkipWhile Cross-site-collections Anonymous users

25 Overview / Summary SQL Metal Strong Typing Relationships Deferred Execution (& client-side queries) Some limitations

26 Overview of Data Technologies LINQLINQ Data Platform Farm Site List Data External Lists Server OM Client OM REST APIs Web Web Services

27 Client OM Server Side SharePoint SharePoint Web services End Client Win SL JS Client OM

28 Accessing SharePoint Data using the Client OM

29 Overview / Summary Much easier than before (asmx only) asmx web services still there if we need them Not limited to defined API Supports 3 client types Managed Clients (sync) Silverlight (async) Javascript (async)

30 Overview of Data Technologies LINQLINQ Data Platform Farm Site List Data External Lists Server OM Client OM REST APIs Web Web Services

31 SOAP Vs. REST i.e. Whats Wrong With SOAP? The Envelope Bloated Not actually 100% interoperable NOT fun from, e.g., Javascript The RPC-style Need to define entire interface operations, params, return types Leads to inconsistencies over time Documentation

32 REST APIs WCF is now supported! What is Representational State Transfer (REST)? And what is OData? Strongly typed (depending on tools...) WCF Data Services Astoria

33

34 REST (OData) APIs Syntax: /_vti_bin/ListData.svc/{Entity}[({identifier})]/[{Property}] Example to get budget hours for Project #4: /_vit_bin/ListData.svc/Projects(4)/BudgetHours

35 REST (OData) APIs Syntax: /_vti_bin/ListData.svc/{Entity}?$filter={simple predicate} Example to get Projects for Clients in Chicago: /_vit_bin/ListData.svc/Projects?$filter=Client/City eq Durban'

36 REST (OData) APIs Syntax: /_vti_bin/ListData.svc/{Entity}?$expand={Entity} Example to get a Project and its related Client: /_vit_bin/ListData.svc/Projects?$expand=Client

37 REST (OData) APIs $filter={simple predicate} $expand={Entity} $orderby={property} $skip=n $top=n $metadata See:

38

39 Overview / Summary Much easier than before (asmx only) asmx web services still there if we need them Not limited to defined API Supports all client types Strongly Typed More Tooling Open standards-based

40 Data Technologies in SharePoint 2010 SharePoint 2010 List Data Model Relationships, Joins, and Data Integrity LINQ to SharePoint, Client OM Simple and integrated developer experience for list based Data Applications WCF & REST (OData) APIs Simplified and standardized model for when you need it

41 Data Access Technologies - Decision Matrix

42 Resources The Moss Show SharePoint Developer Center – SharePoint Tech Center – Official SharePoint Team Blog – Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub.

43 (WTB305) Panel Discussion: Ask the experts about SharePoint (OFC423) Developing a BCS External Content Type with Visual Studio 2010 Related Content

44 Resources SMS [ Your Name ] and the word Office to Need more Information?

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.