cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Issue copying file in flow

Hello all,

 

I'm trying to create a flow to update a Word template we have location in several different locations in our SharePoint Document Library. The flow is able to find all the copies of the template but when I try to copy/replace the template in the various folders it fails. I'm trying to use dynamic content for the folder path. I copied my flow and the error message on the 'Copy File' below.

 

Error on Copy File: "Failed to verify the existence of destination location at 'https://xxxxxxxxxxxx.sharepoint.com/sites/Projects/Shared  Documents/redacted full path/Field Docs/Safety/' due to error 'The system cannot find the file specified. (Exception from HRESULT: 0x80070002)'.\r\nclientRequestId: 0d11fb2d-d57b-4e04-93b2-5606ac1775b3\r\nserviceRequestId: 0d11fb2d-d57b-4e04-93b2-5606ac1775b3"

 

I get this error even though I have verified the file exists in that location.

Screenshot 2020-09-28 111200.png

10 REPLIES 10
Solution Specialist
Solution Specialist

@lokdawg78  - Can you write folderpath into a variable and in the run, check what value it shows? That may help.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
Community Support
Community Support

Hi @lokdawg78,

 

If the destination folder structure does not exist when you copy file, it will report the error: Failed to verify the existence of destination location. Destination folder should make sure it has been created, but acturally it is impossible.

As a workaround, you could use the Create file action instead of Copy file action, it will create the folder if the folder doesn't exists in the destination path, steps as below, please have a try, hope it could help you:

Screenshot 2020-09-29 105949.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@PrasadAthalyeThanks for responding. I changed the flow to just get a single file's metadata since it won't let me run initialize variable inside an apply to each.

 

lokdawg78_0-1601394760923.png

lokdawg78_1-1601394798123.png

Value: /Shared Documents/redacted/redacted/redacted/redacted/Forms/Critical Dig Checklist.docx

 

@v-litu-msftThank you for replying Lin. When I try to create a file, I get another error.

 

Error Details: A file with the name Shared Documents/redacted/Field Docs/Drawings/Doc Mod 40 - Architectural & Structural Revisions/redacted/Field Docs/Safety/Critical Dig Checklist.docx already exists. It was last modified by i:0#.f|membership|tom.stalley@cjerickson on 29 Jun 2020 11:19:58 -0700.
clientRequestId: 207e550c-a038-4db2-9629-9412ab65bbaa
serviceRequestId: 207e550c-a038-4db2-9629-9412ab65bbaa

 

 

So when I try to copy a file, it can't find the directory or verify the directory is there. When I try to create a file it finds the directory but won't create the file because the pre-existing file is there.

Hi @lokdawg78,

 

Ok, we could create a temp file to create not existing folder, then delete it. After all, copy file:

Screenshot 2020-09-30 180637.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msftHey Lin, still getting the same error.

 

I tried updating the flow to first create a copy of the file then move it and still getting the same error.

 

 
 

 

 

 

I don't know if this is relevant, but on the output I'm noticing in the body that the URL of the destination folder isn't a full URL, it looks like it cuts off the URL at the first space in the name.

 

 

 

@v-litu-msftSo I am fixating on the URL in the move/copy step of the flow. Maybe I am completely off, but I can't help but believe this has something to do with the URL being cut off by spaces.

 

The full URL is https://*******.sharepoint.com/sites/projects/Shared Documents/********/Field Docs/Safety/ but gets cut off at the first space.The full URL is https://*******.sharepoint.com/sites/projects/Shared Documents/********/Field Docs/Safety/ but gets cut off at the first space.
The full URL is "https://*****sharepoint.com/sites/projects/shared documents/projectname/field docs/safety/"
The full URL leads to a destination that exists. There are files there. I feel like because it gets cut off the flow fails. I modified my flow to try and fix the issues with the spaces but I've not had any success.
 
first partfirst part
step 2step 2
step 3step 3
 
I don't understand at this point. Am I grabbing the wrong file properties? Is there a different URL property I should be using? Is this just a flaw with MS Flow? I'm losing my mind over this.

I've tried so many variations of this flow. Please help @v-litu-msft  

For what I understand, you are creating a new file with the same name in the same folder of an already existing file, so basically you want to overwrite it.

 

I tried something like that before, instead of using the "copy file", I used the "create file" and adding a "1" or something at the end of the name, once created, the flow will erase the "original" file then rename the "new" file removing the "1".

 

I know that is more steps but it worked for me, while some other connectors gives some errors (or I don't understand the way they work).

Initialize variable at the top something like after trigger. Initialization of variable in the flow is always done at the root level.

 

Inside the loop, you can use Set variable.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (7,087)