Monday, 14 May 2018

Which is better, CAML query or LINQ query in SharePoint 2013?

Collaborative Application Markup Language (CAMLvs Language-Integrated Query (LINQ)



CAML is always better than LINQ because if you write LINQ query then finally it converts in CAML internally so it down the performance. Of course, there are other advantages of LINQ like: Sorting/filtering/can return objects / Most imp part, it is object-oriented etc.

CAML Query Example:

<View>
  <Query>
    <Where>
      <BeginsWith>
        <FieldRef Name="ContentTypeId" />
        <Value Type="ContentTypeId">0x010200</Value>
      </BeginsWith>
    </Where>
  </Query>
  <ViewFields>
  </ViewFields>
  <RowLimit Paged="TRUE">2147483647</RowLimit>