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 / "When a file is create...
Power Automate
Answered

"When a file is created" Flow for SharePoint Online - Document Locked

(0) ShareShare
ReportReport
Posted on by 47

I have a Flow that triggers on 'When a file is created'. The goal of the Flow is to assign a property to the document. The file is created from the New menu in SPO.

 

The problem with this action is the file will be locked, of course, when the user creates the file. The file automatically opens in the browser (usually) thus is locked for editing.

 

Besides using a random retry interval on the trigger, is there any other solution available? I won't know when the document is unlocked as that would be an indeterminiate amount of time, based on user interaction with that document.

Categories:
I have the same question (0)
  • trevorseward Profile Picture
    47 on at
    Disregard, the Retry Interval will not work for this as the action will simply fail. Any other thoughts?
  • hariskadir Profile Picture
    4 on at
    Hi Trevor,

    When you said “When a file is created” do you mean uploading file or creating new microsoft office document?

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
  • trevorseward Profile Picture
    47 on at
    Creating a new file. This action opens the file in the browser, which is the desired behavior.
  • v-bacao-msft Profile Picture
    on at

     

    Hi @trevorseward ,

     

    This is related to the file you created the new file. If you upload a file, this problem will not occur.

    Since Word online has an AutoSave mechanism, when you create a new file, even if you don't click Save button, the file will automatically save and trigger Flow.

    At the same time, in order to avoid content confusion when editing files, the file will be locked, so other actions in Flow may not be able to operate on it.

    You could try adding a Delay action in the Flow, waiting for the file to be edited and automatically unlocked to execute the remaining actions.

    Besides, please check this similar thread and see if it helps:

    https://powerusers.microsoft.com/t5/Flow-Ideas/SharePoint-Wait-for-file-to-be-unlocked/idi-p/180922

     

    Best Regards,

  • trevorseward Profile Picture
    47 on at
    A delay is unreliable. This requires you to know exactly how long you must delay for. This isn't something we'll know as a user can have the file open for an indeterminate amount of time. I need a solution to detect the error, handle it, then retry periodically until it succeeds.
  • Verified answer
    ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @trevorseward 

    Please see my screen shot below and give it a try.  I create a loop and run until a boolean variable equals true.  I am using the run after configuration in the set variable actions to handle the error - this should allow the Flow to proceed until it is successful.

     

    Please note that I haven't tested this (short on time right now...) but I believe it will work for you.

    error1.jpgerror2.jpgerror3.jpg

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard