Handling SharePoint file locks with Power Automate child flows

In 2019 I wrote a post about SharePoint file locks and how to handle these with a retry pattern. But there is an easier way when you use child flows.

SharePoint File locks

In this post I will use the following flow as an example:

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 1

So when a file is create an update to the file properties will fail with the following error message

The file “…/Document.docx” is locked for shared use by ..

SharePoint File locks
Handling SharePoint file locks with Power Automate child flows 2

When looking at the details of the Update file properties action we see a bad requst

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 3
Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 4

And when we look at the retry settings we can see that the error 400 doesn’t result in a retry process kicking in.

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 5

How do we handle the file lock. There are two options. Option 2 is definitely my preferred option!

Option 1 – Retrying using a child flow

To find out more about child flows please have a look at my posts about getting started with child flows.

I’m going to move my update file properties into a child flow:

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 6

And in my main flow I’m going to call my child flow instead of the update of the file properties action. As you can see both the actions look fairly similar to configure, making the replacement an easy task to complete.

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 7

So now we should end up with the following flow

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 8

And when we create a document the retries as kicking in:

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 9

And when we then close the word document that we created the flow will complete with retries. The amber warning sign will however remain in place indicating that there were retries happening before completion.

Handling SharePoint file locks with Power Automate child flows
Handling SharePoint file locks with Power Automate child flows 10

This solutions to retrying file updates when a document is kept open making it a lot easier to handle SharePoint file locks as it uses the out of the box retry mechanism available with Power Automate.

In this case I used the file properties update, but I could quite well imagine that there are other scenarios where it would be useful to retry using a child flow.

Option 2 – Handling file locks using system updates

The second option is all based on doing system updates rather than basic updates. For the details on this approach please read my post about system updates.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading