Karine bosch andy-van_steenbergen-caml-spsbe12

633 views

Published on

When LINQ was introduced into SharePoint 2010 it seamed like the way to go. But more and more we see that LINQ can have a performance impact. Now we see that CAML gains on importance again but it remains an exotic language that not everybody wants to learn. Therefore tools like the new CAML Designer can come in handy.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
633
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Can only operate on one list
  • OrderBy clause is not required.
  • Karine bosch andy-van_steenbergen-caml-spsbe12

    1. 1. CAML is NOT dead! Andy Van Steenbergen Karine Bosch SharePoint MVP
    2. 2. A big thanks to our sponsorsPlatinum SponsorsGold Premium Sponsors Venue SponsorGold Sponsors
    3. 3. About Us• Karine Bosch• SharePoint MVP since 2009• Technical assistent of Patrick Tisseghem till September 2008• Developer of the U2U CAML Builder• Technical Lead SharePoint Competence Center @ ING• Andy Van Steenbergen• SharePoint consultant @ Ordina• Vice-president BIWUG
    4. 4. Agenda• What is CAML?• CAML Basics• CAML Deep Dive• The new CAML Designer
    5. 5. What is CAML?• Collaborative Application Markup Language• XML-based query language• Introduced in SharePoint 2001• SharePoint 2010: LINQ to SharePoint
    6. 6. The Basics• Ordery By• Where• ViewFields• Query options
    7. 7. Order By Clause• To sort list items • In ascending order <OrderBy> <FieldRef Name=“Title” /> </OrderBy> • In descending order <OrderBy> <FieldRef Name=“Title” Ascending=“False” /> </OrderBy> • On more than 1 field <OrderBy> <FieldRef Name=“Title” /> <FieldRef Name=“LastName” Ascending=“False”/> </OrderBy>
    8. 8. Where Clause• Operators • IsNull - IsNotNull • Eq – Neq • Geq – Gt – Leq – Lt • BeginsWith • Contains • Includes • In• Example of a simple syntax: <Where> <Eq> <FieldRef Name=“LastName” /> <Value Type=“Text”>Van Steenbergen</Value> </Eq> </Where>
    9. 9. Where Clause• More than one criterium • Nested XML • And / Or operators• Example of a nested syntax <Where> <Or> <Eq> <FieldRef Name=“LastName” /> <Value Type=“Text”>Van Steenbergen</Value> </Eq> <Eq> <FieldRef Name=“LastName” /> <Value Type=“Text”>Bosch</Value> </Eq> </Or> </Where>
    10. 10. Where Clause• Example of a complex syntax <Where> <Or> <Or> <Eq> <FieldRef Name=“LastName” /> <Value Type=“Text”>Van Steenbergen</Value> </Eq> <Eq> <FieldRef Name=“LastName” /> <Value Type=“Text”>Bosch</Value> </Eq> </Or> <Gt> <FieldRef Name=“DownloadStart” /> <Value Type=“DateTime”>2012-04-28T00:00:00Z</Value> </Gt> </Or> </Where>
    11. 11. Where Clause for DateTime fields• DateTime Fields • Query on date only <Where> <Gt> <FieldRef Name=“DownloadStart” /> <Value Type=“DateTime”>2012-04-28T00:00:00Z</Value> </Gt> </Where> • Query on date and time value <Where> <Gt> <FieldRef Name=“DownloadStart” IncludeTimeValue=“True”/> <Value Type=“DateTime”>2012-04-28T00:00:00Z</Value> </Gt> </Where>
    12. 12. Where Clause for Lookup fields• Lookup fields • Query on lookup value <Where> <Eq> <FieldRef Name=“Country” /> <Value Type=“Lookup”>Belgie</Value> </Eq> </Where> • Query on ID <Where> <Eq> <FieldRef Name=“Country” LookupId=„True‟/> <Value Type=“Integer”>15</Value> </Eq> </Where>
    13. 13. ViewFields Clause• Restrict the number of fields returned• No ViewFields clause • Fields of default view are returned <ViewFields> <FieldRef Name=“LastName” /> <FieldRef Name=“FirstName” /> </ViewFields>
    14. 14. Query Options• RowLimit• IncludeMandatoryColumns• DatesInUtc• ExpandUserField• Files and folder options
    15. 15. Query Options and the SharePoint Object Models• Since SharePoint 2003 • Server Object Model • Lists.asmx web Service• Since SharePoint 2010 • .NET Client Object Model • Silverlight Client Object Model • JavaScript Client Object Model
    16. 16. QUERY OPTIONS
    17. 17. Query Options – Files and Folder options• Where • FSObjType • 0 = Files • 1 = Folders• ViewAttributes • Scope • RecursiveAll • Recursive • FilesOnly• Folder
    18. 18. QUERY OPTIONS – FILES AND FOLDERS
    19. 19. Advanced CAML – New elements• New CAML elements • Includes - NotIncludes <Where> <Includes> <FieldRef Name=„City /> <Value Type=LookupMulti>Antwerp</Value> </Includes> </Where> • In <Where> <In> <FieldRef Name=Title /> <Values> <Value Type=Text>Test 1</Value> <Value Type=Text>Test 2</Value> </Values> </In> </Where>
    20. 20. Advanced CAML (vNext)• New in CAML • Taxonomy Fields• Calendar Lists • DateRangesOverlap• SiteDataQuery
    21. 21. CAML Designer vNext• Related Lists (caml)• Content Type Designer

    ×