This SharePoint CAML query builder tutorial helps how to download and install SharePoint CAML Query Helper. Also, we will see how to use SharePoint CAML Query Helper in SharePoint Online/2013/2010/2007. I will discuss how to connect to SharePoint Online site from caml query helper.
SharePoint CAML helper tool will help build and test SharePoint CAML queries in SharePoint 2013 On-premise as well as SharePoint 2013 Online Office 365 environment. This tool is very much compatible with SharePoint 2010 and MOSS 2007.
Another feature of SharePoint CAML query helper tool is that you can export fields details and query results in CSV.
SharePoint 2016 Tutorial Contents
Let us first and download and install SharePoint CAML query helper in the laptop.
Once your download and unzip you will see two folders. In one folder as the name suggest a setup for MOSS 2007 and SP2010. And another folder contains the ext for SP2013. Open the SP2013 folder and double click on SPCAMLQueryHelper2013.exe.
This will open the dialog box and ask you how to connect to the SharePoint site. You can connect by using the SharePoint object model (in this case tool needs to be installed in the server where SharePoint has been installed). Also, you can connect by using a web service. And also you can connect to your Office 365 SharePoint online site by using web services. First, we will see how we can connect to an on-premise site.
Now, we will first connect to SharePoint 2013 site from CAML query helper. Select Use SharePoint Object Model and click on SUBMIT.
Then it will ask you to give the Site URL, enter the URL and click on Load. This will load all your List and SharePoint Document libraries. Then you can double-click on a particular list and it will load the columns details in the List Info tab, you can also get more details about the list using the MORE LIST DETAIL button as shown in the fig below:
Reload the tool again, And this time Choose option “Use Web Services (Office 365)” and then enter the Username and Password which you connect to SharePoint Online site like below. Because here we will connect to a SharePoint Online Office 365 from SharePoint CAML helper.
Then in the Next screen give the Site URL and click on LOAD. It will Load all the lists and Libraries from the SharePoint Online site.
Now double click on the particular list for which you want to write the query. This will load the list information in the List Info tab. You can able to see more details about the list by clicking on the “MORE LIST DETAIL” button. Apart from this, you can also export all the List Information by clicking on the EXPORT button.
To write the query, click on the Query Helper tool. This provides three tabs Query, View Fields and View Attributes.
From the Fields box, you can drag and drop to the Query text box. In the Row Limit box, enter the value (Row limit). Click on the Search button to search the query.
Then copy the code by clicking on the Copy Code button which will generate the CSOM code which will be look like below:
string sQuery = @”<Query><OrderBy><FieldRef Name=””Modified”” Ascending=””FALSE””></FieldRef></OrderBy><Where> <BeginsWith><FieldRef Name=””Title””></FieldRef><Value Type=””Text””>item</Value></BeginsWith></Where></Query>”;
string sViewFields = @”<FieldRef Name=””Title”” /><FieldRef Name=””First_x0020_Name”” />”;
string sViewAttrs = @”Scope=””Recursive”””;
uint iRowLimit = 100;
var oQuery = new SPQuery();
oQuery.Query = sQuery;
oQuery.ViewFields = sViewFields;
oQuery.ViewAttributes = sViewAttrs;
oQuery.RowLimit = iRowLimit;
SPListItemCollection collListItems = oList.GetItems(oQuery);
foreach (SPListItem oListItem in collListItems)
You may like following SharePoint CAML Query examples:
- How to Use CAML Query for Boolean field for SharePoint 2013/2016/Online Object Model CSOM
- Caml query builder SharePoint 2013 Online
- CAML Query Builder for SharePoint 2013/2016/Online
- Filter CAML Query by List Item ID in SharePoint Online/2013/2016
- SharePoint CAML Query Order by Example with Dropdown in SharePoint Online/2013/2016
- Task assigned to user or current user groups in SharePoint 2010 using CAML query
Hope this will help to download, install and use CAML Query helper for SharePoint Online/2013/2016.
SharePoint Online FREE Training
JOIN a FREE SharePoint Video Course (3 Part Video Series)