Power Automate – Avoiding “File Locked For Shared Use” Failing Your Workflow
In our workflows, we often need to perform file metadata updates, check-ins, moves, etc. If a file is locked and we do not account for it, it can fail our workflow entirely and prevent it from moving forward.
Consider a common scenario of running an approval flow that updates a Status field or other fields based off of the stage of the workflow and end-user responses. Utilizing a “Do until” loop and configuring the “run after” settings of actions we can ensure metadata updates are performed before moving onto the next steps of the workflow.
How does it work?
The basic premise is to create a variable to store the state, then use a Do Until loop to keep trying to update the item. If the update fails, execute a Delay and try again. If it succeeds, update the variable to exit the loop. The Run After conditions need to be set on both the Delay and the Set Variable. The Delay will run when the Update fails or is timed out, while the Set variable will run if the delay is skipped.