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

SharePoint Copy File - issues and bugs

Hello. I have been struggling extensively with Sharepoint - Copy File action, and want to report the following

 

1. When the target file already existst, even if the overwrite flag is set, it throws an error.

The error is 404 "Not found" claiming that the target file is not found! Upon closer examination one can see an extra / added between the Document Library and FIle Path in the URL

>>> Inputs

Source File Path
  StagingInternal/Test 02/Transparent Keyboard 01.png

Destination File Path
  StagingExternal/HER/Test 02/

Overwrite Flag: True

>>> Outputs (URLs redacted)

{
  "message": "The file /sites/###/%2fStagingExternal%2fHER%2fTest+02%2fTransparent+Keyboard+01.png does not exist.\r\nclientRequestId: 5935fdc8-3e61-433f-801b-39ea424b69e6",
  "status": 404,
  "source": "https://###.sharepoint.com/sites/###/_api/web/GetFileByServerRelativePath(decodedUrl=@p)/Etag?@p='%2fsites%2###%2f%252fStagingExternal%252fHER%252fTest%2b02%252fTransparent%2bKeyboard%2b01.png'",
  "errors": [
    "-2130575338",
    "Microsoft.SharePoint.SPException"
  ]
}

Note the "/%2f" in Message and "%2f%252f" (????) in Source, which probably is the cause.

 

Basically, overwriting the file is not possible

 

2. Metadata are not copied. Combined with #2 this is a dead end!

 

3. Since metadata are not copied, one has to rely on Update File Properties. Alas, the latter requires ID field that is numeric, while Copy File does not return it. So, we have a file creation function that does not return a handle to a newly created file...

 

One could use Get File Contents combined with Create File, as a workaround, but that's 2xFileSize data transfer,and it is capped at 50MB. 

 

Basically, there is no way to manage files with MS Flow right now.

Hope this is fixed soon! Thanks!

5 REPLIES 5
Community Support Team
Community Support Team

Re: SharePoint Copy File - issues and bugs

Hi AnotherMSprofil,

 

Thanks for feedback.

 

Using the action “Copy file” in my flow, set the Overwrite flag to Yes, when the target file already exists, the flow throws the error message you mentioned.

 

I will help report this issue on my side and back to you after I got any updates.

 

About #2, Copy file action will only copy the file but no metadata. You may consider adding a request on the Flow Ideas Forum about this issue:
https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

About #3, as a temporary workaround, you could consider using the trigger “When a file is created(properties only)”. Please take the following configuration for a reference:

3.PNG

 

Best regards,
Mabel Mao

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

Re: SharePoint Copy File - issues and bugs

Hi, Mabel.

 

Thanks for pushing #1.

 

As for #3, as I initially wrote:

>>One could use Get File Contents combined with Create File, as a workaround, but that's 2xFileSize data transfer,and it is capped at 50MB.

That is exactly what you had suggested 🙂

 

Is there a way to deal with SharePoint file contents on pure server side (i.e. referencing "File X content") instead of transmitting the actual contents back and forth?

Community Support Team
Community Support Team

Re: SharePoint Copy File - issues and bugs

Hi @AnotherMSprofil,

 

About #1, a fixing is rolloing out. I will keep an eye on it.

 

About #3, I am afraid that it might not be possible currently. Besides, across all Flow connectors and services, the file size limits for uploading & downloading content is 50 M, it is a current limitation.

 

Best regards,

Mabel Mao

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

Re: SharePoint Copy File - issues and bugs

Hi, Mabel.

 

My suggestion for #3 was not to increase the limits, but to return the numeric ID of the newly created file, which should be totally super-easy to implement - just add the (already existing) field to the JSON output. Done.

Saves tons of frustrated posts in the forums and man-hours wasted inventing workarounds.

Can you please escalate that to be implemented along with the fix?

Thanks.

Highlighted
bresleveloper
Level: Power Up

Re: SharePoint Copy File - issues and bugs

Using "When file is created or modified in a folder" event trigger after duplicating the file solves those types of problems

 

https://bresleveloper.blogspot.com/2018/12/microsoft-flow-form-into-excel-create.html

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,923)