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 / Check if file is still...
Power Automate
Unanswered

Check if file is still being uploaded to SharePoint library

(0) ShareShare
ReportReport
Posted on by 8

I have a situation where I may need to run a Power Automate flow that copies files from a SharePoint Library, which could be triggered while some of those  files are still in the process of being uploaded.

 

Ideally, I'd like to delay that copy operation until any such files have finished uploading.

 

Any ideas  how I can establish whether or not certain files retrieved using the "Get files" action are still in the process of being uploaded? I've already established that both the file's Version number and Created date get set when the upload starts, not when it finishes. 

Categories:
I have the same question (0)
  • Adam-Symplifier Profile Picture
    51 on at

    How big are the files that there's a sizeable delay?

     

    Could you just use the 'delay' function after the trigger by a couple of minutes?

     

    I'm making a few assumptions here, you're using the 'when a file is created' trigger, and you're trying to move the files one by one?

  • ssmolen42 Profile Picture
    8 on at

    The files could vary from 50 MB to multiple GB. A delay trigger won't really work for my scenario, unfortunately, but thanks for the suggestion.

     

    I've been trying to move files on a created trigger for testing/POC purposes, but that's not really my goal. I'll do my best to outline my scenario, but note that it's a bit complicated. 

     

    Here's my scenario: I have a PowerApps interface where users can upload files using the attachment control and then clicking a button, which uses the PowerApps v2 connector to upload those files to a Document Library. This works great for files up to 50 MB, beyond which I need an alternative solution. My original idea was adding a link to open a "Upload Queue" Library in a separate tab, which would be configured to only show the user's own files, where they could 1) upload their large files, 2) tab back to PowerApps, 3) click the upload button which would now both upload the <50 MB files from the attachment control and migrate any files they have in the "Upload Queue" library to where they're meant to live, automatically tagging these files with various properties (as is required for my scenario). 

     

    This all works great, in principle, except that if they tab back and click that Upload button before one of their files have finished uploading. As such, I was hoping to configure my Flow (which triggers when they click that Upload button) to loop & delay until all of the files Created By the current user have finished uploading and then do the migration of those (in addition to uploading the files from the Attachment Control), noting that my PowerApps interface is waiting for a callback before proceeding to another screen. It may be worth noting that all of the files must be uploaded before proceeding to that next screen, because there's a Gallery of all context-relevant files from the Library on that next screen which they can then tag with various additional properties. 

     

    The delay would work so-far as I'd have to force my users to wait 5-10 minutes before proceeding (allowing for files of multiple GB), even if they only uploaded a few hundred MBs worth of files, which unfortunately isn't an acceptable UX  for my scenario.

     

    If there was some way for my Power Automate flow to check if the files retrieved via the Get Files action were fully uploaded (in a loop + delay structure, that keeps checking until they're all fully uploaded and then moves on), then everything would work great, but it seems like that may not be an option?

     

    As of now, my alternative solution is to have my users upload their large files directly to the end-destination Library (instead of the "Upload Queue") with some added complexities, which might suffice but is far from ideal for various logistical reasons. 

  • Verified answer
    Adam-Symplifier Profile Picture
    51 on at

    Ok so, would a solution like this work:

    Screenshot 2022-07-26 at 19.00.00.png

    Get the properties of all the files in the upload library and initialise three variables, a current file size (integer), last file size (integer) and and file match (boolean)

    Screenshot 2022-07-26 at 19.00.17.png

    Then in an apply to each with concurrency set to one, we get the metadata of a file and set the file size for 'last file size'. Then we have a 'Do until'.

    Screenshot 2022-07-26 at 19.04.25.png

    The  do until waits 30 seconds, gets the same file, updates the current file size variable and then compares them. 

    Screenshot 2022-07-26 at 19.05.27.png

    If the two match, it  brings an end to the do until, set the variable to false for the next run, then once all the apply to each's are complete, you know every file in that document library is uploaded.

     

    This is partly guesswork on my part, as I'm not 100% how the upload would work, and if comparing file sizes during an active upload would produce different results?

     

    Either way I'm now invested.

  • ssmolen42 Profile Picture
    8 on at

    Yes! I can't believe I didn't think of pulling the file's metadata and comparing the File Size, but there's a solution in there! After running some tests, it looks like the metadata returns a File Size of zero until it's fully uploaded, after which it returns the correct value. This means that it's even simpler than your suggestion - rather than comparing current with previous and waiting for the differential to disappear, we can just check if it's non-zero each time we delay the loop, and that should work!

     

    Regarding my initial question, this means that we can reliably check whether a file has been fully uploaded by calling Get metadata on it and checking if the File Size is non-zero. Awesome. Thanks for the assistance!

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