About CAML in Sharepoint?


What is CAML in Sharepoint?
CAML is Collaborative Application Markup Language and is an XML-based query language that is used in SharePoint. CAML is used to querying, build and customize the SharePoint sites.
Writing CAML Query
CAML root element is <Query>. CAML query has 2 parts
1.       Sort  (For sorting use <OrderBy>) 
2.        Filter
 (For filter use <Where>)
 Basic syntax for CAML query
< [Operator]>
              <FieldRef Name=’ [Title]’/><Value Type=’ [Data Type] ‘> [Value] </Value>
</ [Operator]> 

Operators in CAML
 Logical Operators
                And
                Or
Comparison Operators
Eq =Equals
Neq =Not equal
Gt=Greater than
Geq =Greater than or equal
Lt =Lower than
Leq =Lower than or equal too
IsNull = is null
IsNotNull = is not null
BeginsWith=Begins with
Contains=Contains
BeginsWith = begins with
DateRangesOverlap= compare the dates
In= value of a list item
Includes= specified field is a Lookup field that allows multiple values
NotIncludes=
Membership= filter based on the type of membership.
Group operator
    GroupBy= grouping the data
Example
1            Filter
<Where>
    <Eq>
     <FieldRef Name='Country' />
     <Value Type='Lookup'>India</Value>
  </Eq>
</Where>
2           Sort
<OrderBy>
   <FieldRef Name=''Country' Ascending='False' />
</OrderBy>

Comments

Popular posts from this blog

Display multiple marker point on Google Map with same location or same Longitude,Latitude

How to refresh parent page on close of popup window by toolbar close button

Implementing Zoom functionality in asp.net