Single Line of Text
<Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where>
__________________________________________________________________
Multiple Lines of Text
<Where><Eq><FieldRef Name="Address" /><Value Type="Text">EmployeeAddress</Value></Eq></Where>
__________________________________________________________________
Choice
<Where><Contains><FieldRef Name='Province'/><Value Type='Choice'>East</Value></Contains></Where>
__________________________________________________________________
Number
<Where><Contains><FieldRef Name='Quantity'/><Value Type='Number'>0</Value></Contains></Where>
__________________________________________________________________
Date and Time
<Where><Eq><FieldRef Name="CurrentDate" /><Value Type="DateTime" IncludeTimeValue='FALSE'>2001-01-01</Value></Eq></Where>
__________________________________________________________________
Lookup By Lookup Name
<Query><Where><Eq><FieldRef Name="State" /><Value Type="Lookup">Arizona</Value></Eq></Where></Query>
Lookup By Lookup Id
<Query><Where><Eq><FieldRef Name="State" LookupId="TRUE" /><Value Type="Lookup">4</Value></Eq></Where></Query>
__________________________________________________________________
Yes/No
<Where><Eq><FieldRef Name="Active" /><Value Type="Boolean">1</Value></Eq></Where>
__________________________________________________________________
Person or Group By SPUser.Name
<Query><Where><Eq><FieldRef Name="Author" />Value Type="Text">Josh McCarty</Value></Eq></Where></Query>
Person or Group By SPUser.ID
<Query><Where><Eq><FieldRef Name="Author" LookupId="TRUE" /><Value Type="Integer"><UserID /></Value></Eq></Where></Query>
__________________________________________________________________
Hyperlink or Picture
<Where><Contains><FieldRef Name='URL'/><Value Type='URL'>http://facebook.com</Value></Contains></Where>
__________________________________________________________________
Calculated
<Where><Eq><FieldRef Name='Status' /><Value Type='Calculated'>Completed</Value></Eq></Where>
__________________________________________________________________
CAML Operators
<Eq> – Equals
<Neq> – Not Equals
<Gt> – Greater than
<Geq> – Greater than or Equals
<Lt> – Less Than
<Leq> – Less Than or Equals
<sNull> – Is Null (Is Empty)
<BeginsWith> – Begins with a string
<Contains> – Contains a string
__________________________________________________________________
ORDER BY
<OrderBy> <FieldRef Name="[Field_Name]" Ascending="True" /></OrderBy>
Ex: <Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where><OrderBy> <FieldRef Name="Name" Ascending="True" /></OrderBy>
The default value of Ascending is TRUE (By Default Order is in Descending)
<Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where>
__________________________________________________________________
Multiple Lines of Text
<Where><Eq><FieldRef Name="Address" /><Value Type="Text">EmployeeAddress</Value></Eq></Where>
__________________________________________________________________
Choice
<Where><Contains><FieldRef Name='Province'/><Value Type='Choice'>East</Value></Contains></Where>
__________________________________________________________________
Number
<Where><Contains><FieldRef Name='Quantity'/><Value Type='Number'>0</Value></Contains></Where>
__________________________________________________________________
Date and Time
<Where><Eq><FieldRef Name="CurrentDate" /><Value Type="DateTime" IncludeTimeValue='FALSE'>2001-01-01</Value></Eq></Where>
__________________________________________________________________
Lookup By Lookup Name
<Query><Where><Eq><FieldRef Name="State" /><Value Type="Lookup">Arizona</Value></Eq></Where></Query>
Lookup By Lookup Id
<Query><Where><Eq><FieldRef Name="State" LookupId="TRUE" /><Value Type="Lookup">4</Value></Eq></Where></Query>
__________________________________________________________________
Yes/No
<Where><Eq><FieldRef Name="Active" /><Value Type="Boolean">1</Value></Eq></Where>
__________________________________________________________________
Person or Group By SPUser.Name
<Query><Where><Eq><FieldRef Name="Author" />Value Type="Text">Josh McCarty</Value></Eq></Where></Query>
Person or Group By SPUser.ID
<Query><Where><Eq><FieldRef Name="Author" LookupId="TRUE" /><Value Type="Integer"><UserID /></Value></Eq></Where></Query>
__________________________________________________________________
Hyperlink or Picture
<Where><Contains><FieldRef Name='URL'/><Value Type='URL'>http://facebook.com</Value></Contains></Where>
__________________________________________________________________
Calculated
<Where><Eq><FieldRef Name='Status' /><Value Type='Calculated'>Completed</Value></Eq></Where>
__________________________________________________________________
CAML Operators
<Eq> – Equals
<Neq> – Not Equals
<Gt> – Greater than
<Geq> – Greater than or Equals
<Lt> – Less Than
<Leq> – Less Than or Equals
<sNull> – Is Null (Is Empty)
<BeginsWith> – Begins with a string
<Contains> – Contains a string
__________________________________________________________________
ORDER BY
<OrderBy> <FieldRef Name="[Field_Name]" Ascending="True" /></OrderBy>
Ex: <Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where><OrderBy> <FieldRef Name="Name" Ascending="True" /></OrderBy>
The default value of Ascending is TRUE (By Default Order is in Descending)