0

I’m facing an issue with SharePoint document libraries. When a file in the library is locked, I am unable to:

  • Update the corresponding record
  • Delete the record I understand that the lock prevents changes to the file itself, but I need to be able to update or delete the list/library item even if the file is locked. Has anyone encountered this issue before? Is there a way to handle this scenario via:
  • Power Automate
  • SharePoint API
  • Dynamics 365 integration
  • Any other method Any guidance or workaround would be greatly appreciated!
  1. Standard Power Automate Actions
  • Update file properties → failed (423 Locked)
  • Delete file using Delete File connector → failed (423 Locked)
  • Move / Copy file → failed (SPFileLockException)
  1. Retry / Delay Attempts
  • Added 20–30 sec Delay in Flow → did not resolve the lock
  • Applied retry policy → not fully reliable
  1. SharePoint Settings
  • Checked if co-authoring lock can be disabled → not possible
  1. REST API Attempts
  • CheckOut → worked only if file wasn’t already locked by another user
  • UndoCheckout → sometimes worked, sometimes returned “file not checked out”
  • CheckIn → tried with checkintype=2 (force) → failed if file not checked out
  • ReleaseLock → not supported (404 error)
  • Move / Copy via API → failed due to lock
  1. Other Attempts

Trying to delete file while locked → always failed (SPFileLockException)

Overwriting file content via PUT → successful in clearing Excel Online locks

Then attempted delete/recycle → worked after overwriting

1 Answer 1

0

Have you looked into using the prefer: bypass-shared-lock, bypass-checked-out header in the Graph API requests? I came across it in the driveitem-delete documentation as can be seen here: Delete a DriveItem or see the quote below

Header Name Description
prefer String. Optional. A value of bypass-shared-lock bypasses any shared locks on the driveItem (for example, from a coauthoring session). A value of bypass-checked-out bypasses the checkout condition on the driveItem. Multiple comma-separated values are allowed.

This was useful to me when deleting and moving Word documents that are still being edited/open in the user's browser. Without the header I would get a 423 Locked response.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.