File locked by another user – The file is being used by another process, preventing the flow from accessing it.

Loading

In Power Automate, workflows often interact with files stored in SharePoint, OneDrive, Dataverse, or external storage services. A common issue users face is the “File Locked by Another User” error, which occurs when a flow tries to access a file that is currently open or in use by another process.

Error Message Example:
“The file is locked for editing by another user or process.”

This guide explains:
Why the file lock error occurs.
How to diagnose the issue.
How to fix and prevent file locking errors in Power Automate.


Step 1: Understanding Common Causes of the “File Locked by Another User” Error

CauseDescription
File open in another applicationThe file is currently open in Word, Excel, or another program.
Another user is editing the fileA user is actively making changes to the file.
Multiple flow instances accessing the fileMore than one Power Automate flow is trying to edit the file at the same time.
Syncing issues with OneDrive or SharePointThe file is being updated or synced, causing a temporary lock.
Check-in/check-out restrictions in SharePointThe file is checked out and locked for editing by a specific user.
A previous flow run has not released the fileA prior instance of the flow still has the file open.

Step 2: Diagnosing the Issue

2.1. Check the Flow Run History

  1. Open Power Automate (https://make.powerautomate.com).
  2. Click on My Flows → Select the affected flow.
  3. Go to Run History → Open a failed run.
  4. Look for an error message like: The file is locked for editing by another user or process.
  5. Expand the action details to check:
    • Which file is causing the issue.
    • Which user or process has locked the file (if shown).

Step 3: Fixing the “File Locked by Another User” Error

3.1. Ensure No One Has the File Open

Problem: A user has the file open in an application like Word, Excel, or PowerPoint.

Solution:

  • Ask the user to close the file.
  • If the file is open in Excel Online or SharePoint, ensure it is not in “Edit” mode.
  • Use the “Co-Authoring” feature in Office 365 to allow multiple users to edit at the same time.

3.2. Close Open Applications Holding the File

Problem: A local application (e.g., Excel) is preventing access.

Solution:

  1. Ask users to save and close the file.
  2. If necessary, restart the user’s computer to release the lock.
  3. Check for background processes that might be holding the file (e.g., Excel.exe, Word.exe).
    • On Windows, open Task Manager → End task for Excel.exe or Word.exe.

3.3. Implement a Delay Before Accessing the File

Problem: The file is temporarily locked due to a previous action in the flow.

Solution:

  • Add a “Delay” action in Power Automate before performing file operations.
  • Example:
    • Click “New Step” → Search for “Delay” action.
    • Set the delay to 30-60 seconds.
    • This gives the system time to release the lock before continuing.

3.4. Ensure No Other Flow is Accessing the File at the Same Time

Problem: Multiple flows are trying to edit the same file simultaneously.

Solution:

  • Check other flows that may be using the same file.
  • Use the “Concurrency Control” setting:
    1. Open the flow.
    2. Click on the trigger action (e.g., “When a file is modified in SharePoint”).
    3. Click on “Settings”.
    4. Set “Concurrency Control” to “Off” to ensure only one instance runs at a time.

3.5. Use a Temporary Copy Instead of Editing the Locked File

Problem: The flow needs to modify a locked file.

Solution:

  • Instead of editing the locked file, create a temporary copy and work with it.
  • Steps:
    1. Use “Get file content” to retrieve the file.
    2. Use “Create file” to save it as a new copy.
    3. Modify the new copy instead of the original.
    4. (Optional) Replace the original file after processing.

3.6. Enable SharePoint Co-Authoring (If Applicable)

Problem: SharePoint is restricting simultaneous edits.

Solution:

  • Ensure “Require check-out” is disabled:
    1. Go to the SharePoint Document Library.
    2. Click Library SettingsVersioning Settings.
    3. Set “Require documents to be checked out before they can be edited?” to No.

3.7. Check and Release SharePoint Check-Out Locks

Problem: The file is checked out and locked for editing.

Solution:

  • To release a checked-out file:
    1. Open SharePoint.
    2. Find the file → Click …” (More Options)Check In or Discard Check Out.
    3. If the file is locked by another user, an administrator may need to force check-in the file.

3.8. Implement Automatic Retry for File Actions

Problem: The file is locked temporarily but will be available soon.

Solution:

  • Use “Configure Run After” settings in Power Automate:
    1. Click the failed action.
    2. Click “…”“Configure Run After”.
    3. Set it to retry if the file is locked.
    4. Alternatively, use the “Retry Policy” setting to retry after a few seconds.

Step 4: Preventing Future “File Locked” Errors

4.1. Best Practices to Avoid File Locking Issues

Encourage users to close files after editing.
Use co-authoring for SharePoint files instead of requiring check-in/check-out.
Avoid multiple flows accessing the same file at the same time.
Use temporary copies for editing instead of modifying the locked file.
Set up automatic retries in Power Automate for locked files.


Step 5: Set Up Alerts for File Lock Errors

  1. Open Power AutomateMy Flows.
  2. Click Edit Flow → Add a “Send an email” action if a file lock error occurs.
  3. Configure the email to alert users about the locked file and suggest closing it.

Leave a Reply

Your email address will not be published. Required fields are marked *