How to Lock SharePoint Files for Editing with Power Automate
Question details
The user wants to prevent visitors or members from editing a SharePoint file temporarily while a Power Automate workflow is running or when the file's metadata status is marked as In Progress.

- Product
- SharePoint and Power Automate
- Device & OS
- not provided
- Scenario
- Securing document integrity by restricting edit access during an active automated workflow or review cycle.
- Observed behavior
- By default, files remain editable by site members during workflows unless item-level permissions are explicitly modified or the file is checked out.
Ensure you have Site Owner or Full Control permissions in your SharePoint environment to modify access rights, and verify that your Power Automate account has the necessary licenses to manage item-level permissions.
Modify Item-Level Permissions in Power Automate
The most effective way to lock a file during a workflow is to dynamically remove edit permissions and replace them with view-only permissions using Power Automate actions.
SharePoint inherits permissions from the parent site by default. To lock a specific document, your flow must break this inheritance and assign custom permissions for the duration of the workflow.
If you encounter complex permission routing issues, posting your specific flow structure in the Microsoft Power Automate Community can yield custom, advanced workflow advice.
In your Power Automate flow, add the 'Stop sharing an item or a file' action. Select your Site Address, Library Name, and the Item ID. This removes all existing user permissions except for the site owners.
Add the 'Grant access to an item or a folder' action immediately following the previous step. Input the necessary Site Address, Library, and Item ID, then specify the user or SharePoint group. Set the 'Roles' dropdown to 'Can view' to grant read-only access.
At the end of your workflow (e.g., after an approval is granted or status changes from 'In Progress'), use the 'Grant access to an item or a folder' action again, but this time set the role to 'Can edit' to unlock the file.

Check Out the File via HTTP Request
Use the SharePoint REST API within Power Automate to check out the document, effectively locking it from being edited by other users.
Manage and Share Documents Seamlessly with WPS Office
If you are looking for an intuitive way to manage documents without dealing with complex SharePoint workflows, WPS Office provides a free, lightweight, and highly compatible alternative. It includes built-in cloud storage and straightforward permission controls.
- 1. Open and Save to WPS Cloud: Open your document in WPS Office and easily save it to the built-in WPS Cloud for secure access from anywhere.
- 2. Share with Specific Permissions: Click the 'Share' button in the top right corner. Choose whether to generate a link or invite collaborators via email.
- 3. Lock Editing Access: Select 'View Only' in the permission settings to instantly prevent others from making unauthorized edits to your document.

Frequently Asked Questions
Why do users still have edit access after the Power Automate workflow starts?
If item-level permissions are not explicitly altered or the file is not checked out by the workflow, default SharePoint site permissions will continue to apply, allowing members to edit the document as usual.
Can I lock a SharePoint file based on a metadata column like 'In Progress'?
Yes, you can configure a Power Automate flow to trigger 'When an item or a file is modified'. If the condition detects that the status column equals 'In Progress', the flow can then execute the actions to change the item's permissions to read-only.
What happens if a workflow fails while a file is locked?
If the workflow stops or fails before the permissions are restored or the file is checked back in, the file will remain locked. A site owner or administrator will need to manually restore edit access or discard the checkout in SharePoint.




