• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

GRISCHKE SOLUTIONS

Website and Software Development | IT | Office

  • Home
  • About
  • Services
    • Web Development & Hosting
    • IT, Networking and Cloud Solutions
    • Email and Office Solutions
    • Design Services
    • Quality Management
    • Document Management
    • Performance Dashboard
    • HR Management
    • Payroll Solutions
    • IT Support
    • GDPR
  • Blog
    • How to build an Email Parser in Microsoft Flow (Extract text from email body)
    • Windows 10 1803 new OEM (or ESP) Partition
    • Unprotect Excel Worksheets without Password
    • Data protection law is changing – you need to act now
    • Calculate Ratio Between Two Numbers
    • Charts in SharePoint
    • Microsoft SharePoint Services – What you need to know
    • Hide Featured Images in Genesis using 3 lines of code
    • Workflow loop through SharePoint list
  • Products
    • Basket
  • Enquiry

Workflow loop through SharePoint list

17th May 2017 By Maciek Grischke Leave a Comment

SharePoint 2013 Designer workflows now has two new interesting options: the ability to call HTTP web services and the option to loop over some code a number of times. This, together with the new REST API, which supports querying lists and returning data in JSON, allows iterating through list items in a workflow, something that was not possible before.

In order to demonstrate this, let’s create a new Site Workflow in SharePoint Designer, that will iterate through the Tasks list.

Call it Process Tasks, for example, and make sure you select SharePoint 2013 as the platform type.

In the workflow designer, let’s start by creating a new stage, call it Retrieve Tasks:

In it, we add a new Set Workflow Variable action which creates a new String variable called url with the value “http://sp2013/_api/web/lists/getbytitle(‘Tasks’)/items”. This uses the new REST API, and you can pass in additional options, such as for ordering by the DueDate field in descending order:

http://sp2013/_api/web/lists/getbytitle(‘Tasks’)/items?$orderby=DueDate desc

or filtering:

http://sp2013/_api/web/lists/getbytitle(‘Tasks’)/items?$filter=DueDate gt DateTime’2017-07-31T00:00:00’

or paging:

http://sp2013/_api/web/lists/getbytitle(‘Tasks’)/items?$top=20

Next, we add a Dictionary variable (Build a Dictionary action), call it requestHeaders, and initialize it as this:

Filed Under: Tutorials Tagged With: count, get, items, list, loop, sharepoint, workflow

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

  • Microsoft SharePoint Services – What you need to know
    By Maciek Grischke
    14th March 2017
  • Unprotect Excel Worksheets without Password
    By Maciek Grischke
    18th March 2018
  • Calculate Ratio Between Two Numbers
    By Maciek Grischke
    17th September 2017
  • How to create Charts in Sharepoint
    By Maciek Grischke
    30th April 2017
  • Fix Black Screen in Windows Server 2016 in RDS Farm (UPD)
    By Maciek Grischke
    15th October 2019
  • Home
  • About
  • Services
  • Blog
  • Products
  • Enquiry

 

Designed in-house by GRISCHKE SOLUTIONS © 2019 · Log in

Address

GRISCHKE SOLUTIONS
8 Sycamore Cottages
High Street
Pembury
TN2 4PJ

Site Info

Privacy Statement

Cookies Policy