cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
edwinderry
Level: Powered On

Sharepoint file size returned as zero bytes

I have a flow which is used to log incoming files from customers;

  1. File is uploaded to sharepoint document library.
  2. Item is created in sharepoint list to log the file, who uploaded it and when and also a number of decisions made throughout the remainder of the flow.
  3. File is attached to list item and deleted from library.

There is a file size limit for attachments to list items so I need to check the size before i try to attach to avoid an error and the rest of the flow failing;

  1. Send an HTTP request to SharePoint.
  2. Get file metadata.

Both of these methods sometimes return zero bytes for the file size and therefore my flow fails.

Is this a bug?

1 ACCEPTED SOLUTION

Accepted Solutions
edwinderry
Level: Powered On

Re: Sharepoint file size returned as zero bytes

I've now done some testing, using "Get file metadata" at 0, 10 and 60 minute intervals, uploading files ranging from 100Kb to 150Mb.

It seems that there is an issue if you try to get the file size in the action immediately following the trigger. I would have thought that the trigger would not start until the file upload was complete but this suggests that something is not quite finished when the trigger happens.

So, the result is I'm adding a 10 minute delay after the trigger on all my flows. Not a great solution but will do as a workaround for now.

Hopefully anyone reading this will be helped by what I've found, and Microsoft will investigate.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Sharepoint file size returned as zero bytes

 

Hi @edwinderry ,

 

Have you checked if the source file is empty?

Please share screenshots of your Flow configuration for further analysis.

 

In addition, you could consider adding a Delay action on top of the Get File content or Add attachment action and then delay these actions for 1-2 minutes.

Please take a try and see if it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
edwinderry
Level: Powered On

Re: Sharepoint file size returned as zero bytes

Here is the output of "Get file metadata" which shows the file size as zero;

 

Get file metadata.JPG

 

And the resulting zero is written to the variable, as you would expect;

 

Initialise FileSize variable.JPG

 

But when the file is copied from it's original location to another library the file size is correct;

 

Copy file.JPG

 

When I check the original file it is not corrupt and has the expected non-zero file size.

 

This problem is intermittent and does not seem to be related to how large the file is or what type of file.

edwinderry
Level: Powered On

Re: Sharepoint file size returned as zero bytes

I've now done some testing, using "Get file metadata" at 0, 10 and 60 minute intervals, uploading files ranging from 100Kb to 150Mb.

It seems that there is an issue if you try to get the file size in the action immediately following the trigger. I would have thought that the trigger would not start until the file upload was complete but this suggests that something is not quite finished when the trigger happens.

So, the result is I'm adding a 10 minute delay after the trigger on all my flows. Not a great solution but will do as a workaround for now.

Hopefully anyone reading this will be helped by what I've found, and Microsoft will investigate.

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

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

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 (9,028)