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

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

How i deal with this is to run a increasing delay action i.e. 2 minutes, 10 minutes, 1 hour, 3 hours, 1 day etc.

 

The delay action runs after a failed attempt to access the excel file.

seanmcev
Level: Powered On

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

Hello, 

 

So I encountered this error when I was creating a flow to update a Word Template based on D365 field values then create a docx file in SharePoint. My flow is prompted on D365 record create. So I would get the error whenever I would test the flow. However, when I prompted the flow with fresh data it worked as desired. So maybe try adding the now() expression to your flow. That prevented me from getting this error. It might be getting hung up on the file existing or being opened for edits previously in the flow. 

 

I am relatively new to Power Automate so sorry if my terminology is wrong. 

juresti
Level 8

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

Hi @seanmcev, Where do you add this Now() expression at?

seanmcev
Level: Powered On

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

That would depend on the flow. Likely whatever step is giving you this error. In my case, I added it to the Create File (SharePoint) action at the end of my file name. 

 

The Now() expression is found here in dynamic content. 

 
 
seanmcev
Level: Powered On

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

@juresti 

 

Sorry my image is not uploading it is in the expression section of dynamics content and its it "utcNow()"

chris1234
Level: Power Up

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

Thank you @Gristy , that approach worked for me.  I did the following steps to solve this for my situation:

 

  1. Initialized a boolean variable called UpdateSucceeded to False
  2. created a Do Until loop based on UpdateSucceeded where it will stop looping when it equals True
  3. In the loop, I first set the UpdateSucceeded variable to True
  4. Then I updated the file what was giving the lock error (in my case a SharePoint Library file property)
  5. This is the important part:  then in the next action, a Set Variable action, I set UpdatedSucceeded to False.  However, in the properties of Set Variable, you need to select "Configure after run",  and uncheck "is Successful" and check "has failed" and "has timed out".  This way UpdatedSucceeded will only be set to False when the file update failed.  If the file update is successful, then UpdatedSucceeded is left as True and the Do Unitl loop is exited.
  6. Then I set a delay, that stepped up in value as @Gristy suggested.

That did the trick for me.  

Super User
Super User

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

glad you got it sorted, its a shame it does not have auto-retry built in or a wait a bit like nintex/sharepoint designer did!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Kudoed Authors
Users online (4,399)