Blog > Learn to Use CAML Query – Part 2

Learn to Use CAML Query – Part 2

August 2, 2017 4 min read
Configuration

[et_pb_section fb_built=”1″ _builder_version=”3.22″][et_pb_row _builder_version=”3.25″ background_size=”initial” background_position=”top_left” background_repeat=”repeat”][et_pb_column type=”4_4″ _builder_version=”3.25″ custom_padding=”|||” custom_padding__hover=”|||”][et_pb_text _builder_version=”4.9.4″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” hover_enabled=”0″ sticky_enabled=”0″]

Following the last blog, Learn CAML Statements Part 1, this blog looks at some of the CAML comparison operators that can be used within Collaborative Application Markup Language (CAML) queries. There are a few not listed i.e. In, Includes, NotIncludes, as these are not supported at present in BrightWork.

 

CAML Comparison Operators

In the example above, the <Eq> is a comparison operator. It looks to see if one value equals another. There are many different types available in CAML.

NOTE: CAML is case sensitive

 

Query

Open

Close

Syntax Example

Details

Equals <Eq> </Eq>

 

<Where>
<Eq>
<FieldRef Name=’AssignedTo’ />
<Value Type=’UserMulti’>John Doe</Value>
</Eq>
</Where>

 

Assigned to is equal to ‘John Doe’
Not Equals <Neq> </Neq>

 

<Where>
<Neq>
<FieldRef Name=’AssignedTo’ />
<Value Type=’UserMulti’>[Me]</Value>
</Neq>
<Where>

 

Assigned to is not equal to ‘Me’ i.e. the logged in user
Greater Than <Gt> </Gt>

 

<Where>
<Geq>
<FieldRef Name=’DueDate’ />
<Value IncludeTimeValue=’TRUE’ Type=’Date’>2017-06-13</Value>
</Geq>
</Where>

 

Due Date is greater than ‘2017-06-13’
Greater Than or Equal To <Geq> </Geq>

 

<Where>
<Geq>
<FieldRef Name=’DueDate’ />
<Value IncludeTimeValue=’TRUE’ Type=’Date’>2017-06-13</Value>
</Geq>
</Where>

 

Due Date is greater than ‘2017-06-14’
Less Than <Lt> </Lt>

 

<Where>
<Lt>
<FieldRef Name=’PercentComplete’ />
<Value Type=’Number’>50</Value>
</Lt>
</Where>

 

PercentComplete is less than 50
Less Than or Equal To <Leq> </Leq>

 

<Where>
<Leq>
<FieldRef Name=’PercentComplete’ />
<Value Type=’Number’>50</Value>
</Leq>
</Where>

 

PercentComplete is less or equal to than 50
Is Null <IsNull> </IsNull>

 

<Where>
<IsNull>
<FieldRef Name=’AssignedTo’ />
</IsNull>
</Where>

 

Assigned to is null / Assigned to contains no value
Is Not Null <IsNotNull> </IsNotNull>

 

<Where>
<IsNotNull>
<FieldRef Name=’Attachments’ />
</IsNotNull>
</Where>

 

Attachment is not null /Item has an attachement
Contains <Contains> </Contains>

 

<Where>
<Contains>
<FieldRef Name=’Status’ />
<Value Type=’Choice’>Late</Value>
</Contains>
</Where>

 

Status contains ‘Late’
Begins With <BeginsWith> </BeginsWith>

 

<Where>
<BeginsWith>
<FieldRef Name=’Priority’ />
<Value Type=’Choice’>(2)</Value>
</BeginsWith>
</Where>

 

Priortiy begins with ‘(02)’
Membership

<Membership

Type = “Text”>

</Membership>

 

<Where>
<Membership Type=”BrightWork Members”>
<FieldRef Name=”AssignedTo” /></Membership>
</Where>

 

The person listed in ‘AssignedTo’ is a member of the group ‘BrightWork Members’

 

 

BrightWork Services for SharePoint

 

 

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Categories
Ciara McCarthy

Ready to Centralize Your PMO? See BrightWork 365 in action