Skip to main content

CAML Query Filtering

You can use CAML Queries to filter your SharePoint lists or document libraries to limit the results you want to return.

To input your CAML Query connect to your target SharePoint list or document library. Now find the ListViewCAMLQuery property in the connection property window and click on the ellipsis (...) to open the editor.

Open Query Editor

Enter your chosen query into the field and click OK to save.

CAML Query

You can add the columns you need to the schema map and click Preview A to preview the data and return the results of the query.

Query Results

Query Examples

When referencing the item you wish to query you need to include the Root Folder, the List Folder and any sub folders you have within your library separated by a /.

In our examples below we are connected to a Picture Library and wish to return only one specific image. The root folder and list folder can be gathered from the connection properties around the ListViewCAMLQuery box.

List and Root Folders

For this example we have a root folder of /Test/ a list folder of PictureTest, and a sub-folder of Folder1.

To return single values you can use:

<Where>
<Eq>
<FieldRef Name="FileRef" />
<Value Type="Url">/Test/PictureTest/Folder1/delete-file-foreach.png</Value>
</Eq>
</Where>

To return multiple values, you can use:

<Where>
<In>
<FieldRef Name="FileRef" />
<Values>
<Value Type="Url">/Test/PictureTest/Folder1/delete-file-foreach.png</Value>
<Value Type="Url">/Test/PictureTest/Folder2/delete-file-foreach.png</Value>
<Value Type="Url">/Test/PictureTest/Folder2/delete-file.png</Value>
</Values>
</In>
</Where>

For more information on CAML Queries please see the Microsoft page here: https://docs.microsoft.com/en-us/sharepoint/dev/schema/where-element-query .

info

If your find your CAML query is not making any changes or isn't returning any data, please ensure you have included the WHERE element as shown in the examples above.