SharePoint Experts Blog

SharePoint Get Items workflow actions

In the previous article, I compared Get Items by Query workflow action with OOB workflow. In this post, I would like to dive deeper and describe a few more actions and describe how they work.

We have the following actions that you can use to get items from a list:

-        Get Items by Query

-        Get Items from View

-        Get Items by CAML Query

-        Get Items by CAML Query (Many Lists)

They all starts from “Get Items” but they have some nuances of usage and actually could be useful for different situations.

Get Items by Query

This is the most modern and preferable implementation of get items action. We recommend it for using. Inside, it is based on REST query to “listdata.svc” or “client.svc” web services. By default, it uses listdata.svc because it allows a lot more operators like startswith, substringof, top skip and others. You can find some useful examples in the following article: SharePoint: Adventures with the REST API Part 1. However, you can change service endpoint to client.svc, for some cases it could be more convenient and maybe a bit more familiar because when you use such implementation the request goes through “_api/web/lists” endpoint. So many people are knowing how to work with this REST API and on the Internet, there is a lot of articles and documentation how to work with this service.

To know more about OData queries, I would recommend check out the following article:

Use OData query operations in SharePoint REST requests

Understanding SharePoint’s REST and Search API Part 1 – Selecting Items

Some additional links:

Limitations of SharePoint ListData.svc

 

Get Items from View

I suppose this is the most user-friendly action because everything you need to do it is just to configure a view for a list via SharePoint UI and specify the name of the view as a parameter. After that, you will get list items. You don’t need to know REST or CAML, you can configure everything via UI.

 

Get Items by CAML Query

This workflow action designed for true SharePoint developers, you can create a query manually and there are no any limitations. Currently, it used rarely, but you should know about this if you want to implement some complex scenario and of course you should be familiar with CAML queries.

 

Get Items by CAML Query (Many Lists)

Some old developers maybe know about SPSiteDataQuery object that was available in SSOM only. And this workflow action is an almost full analog of this object. You can query many lists at once using the same CAML query. Personally, I would not recommend to use it because in most cases you can find a simpler workaround.  

Posted in: Workflow Actions Pack