cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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. 

 

 

 

 

58 REPLIES 58

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.

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 🙂

Anonymous
Not applicable

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?

Anonymous
Not applicable

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.

Anonymous
Not applicable

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...

russoedu
Advocate II
Advocate II

Also having a similar issue, but in my case, I run an Office Script right after the file is uploaded.

 

russoedu_0-1675692991255.png

In this Child flow I was trying to update the properties in a loop, trying every 15 seconds.

 

After I put the checkout / discard checkout, it's always working on the first attempt (it used to take 20).

russoedu_1-1675693229127.png

 

 

 

GerryBrimacombe
Frequent Visitor

I am running into a similar issue, but slightly different.

 

I am using a Button Flow to process an Excel file and load it into a list. 

When the Excel data is successfully loaded into the list, I want to update a Status metadata field to LOADED. Of course that Status field is part of the Excel fiel COOntent type.

 

No sweat, right?

 

But I am consistently getting the file is locked by me (the person running the Flow). I have added the loop as recommended by @PowerSA  above, and also detailed in this article. That works, but it takes about 6 minutes for the Flow to recognize the file as unlocked.  

 

I love the idea of CANCEL CHECK-OUT by @russoedu , but I am getting an error "FILE IS NOT CHECKED OUT". What am I missing? I tried to check it out before my Get Excel Data From Table" action, but i get the same "FILE LOCKED" condition. Can I get the data without locking the file, or by locking it briefly and then unlocking?

 

Thank you,

Gerry

 

Marianr99
Frequent Visitor

Hello 🙂

Did you find any solution?

 

Thank you 

This works Chris 1234 see previous thread he wrote on page 2 of replies.

 

Thank you so much!

sarizvi
New Member

The flow must wait out till the file is locked. To do this Create a Do Until with a 30 seconds delay to loop until the file is not locked.

 

sarizvi_0-1718267813947.png

 

 

Steps

  1. Initialize a Variable ‘File Locked’ as Boolean
  2. Create a Do Until Loop to check a variable ‘File Locked’ = false
  3. Inside the loop
    1. Add a 30 Seconds Delay
    2. Get file properties
    3. Set Variable File Locked to Get File Properties >> Checked Out

sarizvi_4-1718267942643.png

 

 




That will timeout after 5000 loops of do until. 42 hours.

sarizvi
New Member

Yes, but:
1. Normally no one keeps the file open for 42 hours

2. in case of an exception, we can create a counter and terminate after 4999 loops.

 

However, the solution should work of almost all usual cases
1. File Created from Template using "New >> Content Type" menu (this is where most of the challenges arise)
2. File uploaded

On a Friday evening, most don't work weekends 😀

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Top Kudoed Authors
Users online (2,647)