cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neeraj_bharati
Advocate II
Advocate II

Getting error The file is locked for shared use by when updating the file properties

Using Microsoft Flow, I am trying to set default value in a metadata column "Column_1" from a sharepoint OOTB "Created By" column whenever a new item created in a document library. Document library has certain content types associated so when I create a new document by choosing a content type, the Office online opens the document in Edit mode. 

 

I am getting below error when I try to update column "Column_1" using "Update file properties" action

 

Error 423: The file <filename.xlsx> is locked for shared use by <email id>. clientRequestId:<xxx> serviceRequestId:<xxx>

 

How can I check the status of the file if locked or not? Any help is much appreciated. 

 

 

 

 

49 REPLIES 49

We did something like this, check if the file is locked, send an email to the user that has the file locked, check again after x amount of time, do this 3 times then fail and send email why it failed to the user.

PowerSA
Frequent Visitor

I'm using this solution:

Power Automate – Avoiding “File Locked For Shared Use” Failing Your Workflow - Thrive (thrivenextgen...

 

If the file is opend by another user (or yourself) and not closed, then this is not a solution as will fail anyway. But if you configure the settings to wait long enough (maby more that one day) then the chance of success is there 🙂

As I noted here:  link
You use the out-of-the-box API to check if the file is locked or not, then move forward.   If the file is locked, loop again...

https://abc.sharepoint.com/sites/somesite/subsite/_api/Web/lists/getbytitle('Library%20Name')/items(123)/File/LockedByUser 

123 is the ID of the item you want to check.

If you are creating a document archival workflow, sure, you can wait for days, but most of the business-related workflows I've ever dealt with are time sensitive.

@Talyorlak Simple and awesome solution ! thank you for sharing

Is Microsoft working on a better solution to this? The files I'm currently working with are time sensitive, could two connections solve the issue? i.e open with one account and update with another removing the file lock?

PowerOutage
Helper III
Helper III

Is Microsoft working on what?  File locking is baked into SP for a reason, and has been around for many years and versions.

 

In your flow, add a check to see if the file is locked, if yes, loop... There are plenty of examples on this forum and the web.

 

You don't have to wait hours or days for the file to be unlocked.

I know how to loop the file.. I want a solution where the excel can be opened instantly and the information in the table used straight away. If you must pry a company i work for is sent test results that are time sensitive, i want them to be on Sharepoint the minute they get the email. Im not the only one. Sorry to Ask pal, go for a walk.

I just got back from a walk, and guess what, Microsoft still hasn't fixed a decade old problem.

 

In all seriousness, try opening a Premier Support ticket and you might get a better answer.

Hi,

I am stuck with the same requirement and same error, any help on this will be greatly appreciated.

 

Thank you so much.

There's no fix available, only a workaround.

Try thinking about your flow logic differently. 
Instead of:
File is updated --> Send email with link

Try something like:
File is updated --> check if files is locked --> Locked --> Loop until lock is released  --> Send email
                                                                   --> Not locked --> Send email

Checking if the file is locked is easy and is noted in my previous post:  
Re: Getting error The file is locked for shared us... - Page 3 - Power Platform Community (microsoft...

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,994)