How to Fix the "File Locked for Shared Use By" Error in Power Automate Flows
In today’s video, we tackle a common issue encountered in Power Automate flows: the “file locked for shared use” error. This problem often arises when a document is opened and approved in a browser, but the workflow still sees it as being edited, preventing updates to the file properties.
Understanding the Issue
The scenario presented involves a user sending a document for review. The reviewer opens the document in their browser, approves it via email, and closes it. Despite this, the workflow believes the file is still being edited, leading to an error when attempting to update the file properties.
Steps to Replicate and Resolve the Issue:
Set Up the Workflow:
- Create a document library with some documents.
- Set up a simple flow triggered by selecting a file, initiating an approval process, and assigning the task to a reviewer.
- After approval, the workflow attempts to update the file properties with the reviewer’s comments.
Encounter the Error:
The reviewer opens the document in the browser and approves it via email. The workflow fails when trying to update the file properties, showing the “file locked for shared use” error.
Implementing the Workaround:
- Enable Check-in/Check-out Feature: Navigate to the document library settings and enable the requirement for documents to be checked out before editing.
- Adjust the Flow: Modify the flow to check out the file before updating properties and check it back in afterward.
- Add actions in the flow to check out the file, update the properties, and check the file back in.
- Ensure the approval process remains smooth, with the reviewer only needing to review the document in read-only mode.
Enable Check-in/Check-out:
- Go to the document library settings, enable check-in/check-out under versioning settings.
Modify the Flow:
- Edit the flow to include actions for checking out the file, updating properties, and checking the file back in.
Run the Workflow:
- Trigger the flow, and the reviewer receives the approval request.
- The document opens in read-only mode, preventing editing during review.
- The workflow successfully updates the file properties and checks the document back in after approval.
- This approach ensures that the document is not locked for editing by the reviewer, allowing the workflow to complete successfully without errors.
Conclusion
By enabling the check-in/check-out feature and adjusting the workflow to manage file states correctly, you can avoid the “file locked for shared use” error in Power Automate flows.
Watch the full video for a detailed walkthrough.