Introduction

One of the most common challenges while working with Microsoft SharePoint and Microsoft Power Automate is efficiently handling large SharePoint lists containing more than 5000 records.

Although the Get items action supports pagination, enterprise-level solutions often require significantly better control over large data processing, including batching, logging, filtering, performance optimization, and error handling. In such scenarios, implementing a Do Until loop with incremental ID-based batching logic becomes a scalable and reliable solution.

In this article, we will implement a batching approach to efficiently retrieve more than 5000 SharePoint records using Power Automate. Instead of fetching all records in a single execution, the flow will retrieve records in batches of 5000 items at a time, process each batch, and then continue retrieving the next set of records sequentially until all items are processed.

This approach helps

By the end of this article, you will understand how to design a reliable batching mechanism for processing large SharePoint datasets efficiently in Power Automate.

Steps for implementation

Screenshot 2026-05-11 190143

Step 1 : Create the Flow

Create a new flow:

Add trigger:

Step 2 : Initialize Variables

Variable 1 - LastRecordID

PropertyValue
NameLastRecordID
TypeInteger
Value0

Variable 2 - LastRetrievedNoOfRecords

PropertyValue
NameLastRetrievedNoOfRecords
TypeInteger
Value0

Step 3 : Add Do Until Loop

Add Do - until and condition it to run until:

LastRetrievedNoOfRecords is equal to 0

Meaning:

Step 4 : Add Get Items Inside Loop

Inside the Do Until, add Get Items action:

PropertyValue
Site AddressYour SharePoint Site
List NameYour List
Filter QueryID gt @{variables('LastRecordID')}

Imp: Turn On Pagination and set threshold to '5000'.

This ensures filter query:

Step 5 : Set Retrieved Record Count

After Get items:

Add: Set Variable

Update: LastRetrievedNoOfRecords

Value:

length(outputs('Get_items')?['body/value'])

Purpose:

Step 6 — Add Condition

Add condition:

LastRetrievedNoOfRecords is not equal to 0

Meaning:

Step 7 — Update LastRecordID

Inside: If Yes

Add: Set Variable

Variable: LastRecordID

Value:

last(outputs('Get_items')?['body/value'])?['ID']

Purpose:

Example Scenario

Suppose a SharePoint list contains:

25,000 records

Instead of retrieving all records together:

This creates efficient batch processing.

Conclusion:

Using a Do Until loop with batching logic is an efficient and scalable approach for retrieving more than 5000 SharePoint records in Microsoft Power Automate. By processing records in smaller batches using incremental IDs, we can improve performance, reduce timeout risks, and handle large SharePoint lists more reliably in enterprise-level automation solutions.