cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

HTTP Post request - Copy file from one SharePoint site to another site

Hello Cat Happy

 

My code is sending a HTTP POST message to a Flow, the flow is going to copy a file to a specified site in SharePoint.

The http POST is received properly it seems, but the "Copy File" action fails.

 

wrong.png

The system cannot find the file specified.

I know the file is there, but is there something wrong with my syntax so the Flow can't find the file properly?

I appreciate every help I can get.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

I got it to work eventually Cat Happy 

I changed the input variables to:
correct.PNG

Changed File to Copy field with Library or List (or folder) name and then the Filename.
No need for ItemId or anything like that.

View solution in original post

5 REPLIES 5
v-yamao-msft
Community Support
Community Support

Hi @Anonymous,

 

The error message says that the specified file cannot be found. I am afraid that the filepath is not valid.

From the doc on SharePoint we know that action Copy file will copy a file in SharePoint libraries. I guess this action can only be used to copy files between SharePoint libraries.

What’s the return value of dynamic content “filepath”? Please make sure it is a valid path.

Besides, please try to use the action Create file instead.

 

Best regards,

Mabel

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.
Anonymous
Not applicable

Hello @v-yamao-msft, thank you for helping me.

 

I also think the filepath is not valid. The copy action is from Site Pages library in a site, to another Site Pages library so in theory I think it should work.

The "filepath" value that is sent in the POST is the same as I use in my browser to find the file, but maybe Flow treats it differently. Possibly need to change the Url passed in?


I need to copy the file (have an identical page in the Site Pages library no. 2), so I'm not sure if I can Create File and make it work(?).

wrongurl.png

Here you can see the filepath value that is passed in. Maybe change something with these values?

Anonymous
Not applicable

@v-yamao-msft

 

Do you know how the original File path is constructed? as a full Url or not?

 

filepath.PNG

Anonymous
Not applicable

this.PNG

In the documentation it says "sourceFileId" so I will try to send in the Id of the file, maybe it works.

Anonymous
Not applicable

I got it to work eventually Cat Happy 

I changed the input variables to:
correct.PNG

Changed File to Copy field with Library or List (or folder) name and then the Filename.
No need for ItemId or anything like that.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,428)