web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SharePoint create file...
Power Automate
Unanswered

SharePoint create file action fails as file either already exists or file is locked

(1) ShareShare
ReportReport
Posted on by

I'm trying to build a quite simple flow, pulling some file contents via HTML GET, create an Excel file with a table and then list some filtered rows from that table. In order to setup that flow I had to create the tempClosure.xlsx in the destination folder, containing Table1
Closure Report flow.png

To my utter satisfaction, this worked like a charm on the first try 

Closure Report 1st run.png

But next time it failed with 

The file https://{tenant}/sites/{site}/GRDA/Closure Report/tempClosure.xlsx is locked for shared use by {me}

 

I then added a step to delete the file after use. Now the Create File action succeeded, but the List rows present in a table step failed, because it referred to the original table ID, which no longer existed:
No table was found with the name '{301239FC-7969-4BFC-8010clientRequestId: 3a02dda4-663a-4466-9b32-5d8e90a6a4bf

 

As suggested in several posts in the community, I added a check-in step before the create file action to ensure the file is not checked out. That worked as well on the first try, but again just once. Next run failed with the same initial error
The file https://{tenant}/sites/{site}/GRDA/Closure Report/tempClosure.xlsx is locked for shared use by {me}

Why is that file locked for shared use by me? When I open it from the SP Library, it says 

To prevent accidental changes, the author has set this file to open as read-only. [Edit Anyway]


May this be causing the issue? I'm not aware of where the flow would set this flag, is there a way to supress/remove it?

 

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Interesting issue. Couple of things to check.

     

    1. Add a delay before you create the file.

    2. Check the SharePoint library settings not enabled for default checkout.

     

    Try the first option. If that doesn't work then try the second one. Let me know the results.

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    @abm thanks for your prompt reply. Default checkout wasn't enabled on the library.

    I added a delay of 2 minutes, it still failed. Then I tried 10 minutes and it timed out.

    After dozens of tests, it turns out that 8 or 9 minutes of delay do the trick.

    6 minutes mostly fails, 7 minutes rarely, 8 or 9 never, and 10 minutes times out. Truly interesting.

    Beat_0-1630534359113.png

    So I'm gonna go for 8. But WHAT THE HECK is locking that file approx. 7 minutes before my flow is actually going to attempt to overwrite it? It can only be my flow itself, but HOW and WHY? For a moment I thought it would by the interval between flow runs, but no, if I launch it with 7 minutes delay immediately upon a completed or failed run, it most likely will succeed, but if I launch it with 6 minutes delay hours after the previous run, it is still very likely to fail. What kind of logic is behind all of this???

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    This could be behind the scene system is doing something. I could offer another logic. Once the process is done can't you move the file to another location so that always the file creation won't complain about the lock out. Anyway glad to hear that the delay technique was useful. Thanks a lot for the update.

     

  • Community Power Platform Member Profile Picture
    on at

    @abm thanks, but no, I can't move the file as otherwise in the next run, the list rows in a table action will will fail with "No table was found with the name '{301239FC-7969-4BFC-8010)". Although the filename and table name are the same, it is linked to the original table ID rather than the table name.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    This blog might help

     

    Power Automate – Excel Dynamic Filename – Flow Alt Delete – Josh Cook [Microsoft MVP]

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    With 8 minutes delay it still failed once upon a time, set it to 9 and cross fingers. 

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Its worth raising with Power Automate Microsoft support team as well. 

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard