CAML Query Builder for SharePoint 2013/2016/Online

Here we will discuss CAML as well as the free CAML query builder tool in SharePoint 2013 and how we can use the U2U CAML query builder tool step by step. Here we will discuss how to CAML query builder for SharePoint 2013/2016/Online. We can use CAML query builder for SharePoint Online and SharePoint on-premises versions.

We will see how to download and install CAML query builder for SharePoint 2016/2013/Online, how to use CAML query builder in SharePoint.

Introduction to CAML Query Builder in SharePoint Online/2013/2016

CAML know as Collaborative Markup Language is an XML based language for querying and updating SharePoint objects like List and Libraries. CAML helps us retrieving items from a SharePoint list based on various conditions, we can also put order by, can also limit items returns from the query etc.

The below is a simple syntax of the CAML query:
<FieldRef Name=”FieldName” />
<Value Type=”DataType”>Value</Value>
<FieldRef Name=”FieldName” />
<FieldRef Name=”FieldName” />

Here we can use various other operators like below:

Comparison Operators General Meaning
Eq =
Gt >
Lt <
Geq >=
Leq <=
Neq <>
Contains Like
IsNull Null
IsNotNull NotNull
BeginsWith Beginning with word
DateRangesOverlap compare the dates in a recurring event with a specified DateTime value, to determine whether they overlap

Rather than writing the query manually, we can use a free tool known as CAML query builder to generate the query.

Download & Install CAML Query Builder in SharePoint

This is a great tool to create and test CAML queries in SharePoint. This will work with both on-premise as well as SharePoint online. You should have Microsoft .NET Framework 4.5 installed in your machine else it will not work.

First Download the Tool from this URL and then install it. You can download “U2U Caml Query Builder for SharePoint 2013 (Standalone Edition)”.

Once installation over, when you will open the tool, it will open the Connect dialog box, through which you will be able to connect to your on-premise as well as your online environment. see fig below:

download u2u caml query builder for sharepoint 2016

download u2u caml query builder for sharepoint 2016

Here first I gave my on-premise URL and when I connect it, it displays me all the list and libraries presented in the site like below:

caml query in sharepoint 2013 examples

caml query in sharepoint 2013 examples

Similarly, you can also connect to a SharePoint Online site. When connecting to online site, you have to provide the Username and password. And then the URL.

Enter the URL like If you will add /SitePages/Home.aspx, it will through an error. See fig below:

CAML Query Builder for SharePoint 2013/2016/Online

CAML Query Builder for SharePoint 2013/2016/Online

Here in my SharePoint Online, I have a list name as TestList and I want to build the query for that list.

Now select the List and then New query -> Query with View Fields as shown in the fig below

u2u caml query builder sharepoint online

u2u caml query builder sharepoint online

This will create two tabs one is Query and another one is View Fields. In the View Fields tab you can select the Columns which are you want to query like below: Here I have selected the ID, Title, and First Name columns and it showed me the query in the Editor window.

download u2u caml query builder for sharepoint 2016

caml query builder sharepoint

Any time you can run the query and can see the results. It will also generate the CSOM Code and Server side code for this which you see from the corresponding tabs.

Now let us go to the Query tab and add some filter criteria into the query.

Here I added a Filter that If Title Contains Items and then added Title equals Sharepoint item-1. You can add the Or or And condition by click on the Filter drop-down.

Similarly If you want to add one Order by then you can click on the Add order by element button and then select the Column and the condition whether Ascending or Descending. Then it will generate the query for you in the Editor box.

u2u caml query builder download

caml query builder sharepoint 2013

If you want to use the same query in a CSOM code, then you can write like below:

using (ClientContext ctx = new ClientContext())
Web web = ctx.Web;
List list = web.Lists.GetById(new Guid(“5c42def2-bd2c-4df6-bcca-359351944cd2”));
var q = new CamlQuery() { ViewXml = “<View><Query><Where><Or><Contains><FieldRef Name=’Title’ /><Value Type=’Text’>Items</Value></Contains><Eq><FieldRef Name=’Title’ /><Value Type=’Text’>Sharepoint item-1</Value></Eq></Or></Where><OrderBy><FieldRef Name=’ID’ Ascending=’False’ /></OrderBy></Query><ViewFields><FieldRef Name=’ID’ /><FieldRef Name=’First_x0020_Name’ /><FieldRef Name=’LinkTitle’ /></ViewFields><QueryOptions /></View>”};
var r = list.GetItems(q);

You may like following SharePoint CAML Query examples:


Here I have explained how to download and install U2U CAML Query Builder for SharePoint. How we can use CAML query builder in SharePoint 2013/2016/Online.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

  • AMK says:

    Bijay …Bery good

  • Alan Xie says:

    Thank you so much for the sharing!

  • >