cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

SharePoint Action Copy File - Syntax and can you use dynamic content?

I'm trying to copy a file in SharePoint from one library to another.  I'm having trouble with 2 things:

 

  1. The Syntax used in the Source and Destination paths for files.  See below. There is an example for how to configure the Site Adress...but not the Source and Destination File Path.  

Copy File Action.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

So no problem, right? I'll just put in some Dynamic Content...maybe the "Link to item" or site/library/ followed by Dynamic content "Name" (filename)...so like this  site/library/NAME  but that doesn't seem to work.  I received multiple errors,  a 400 Bad Request error, then a 403 Forbidden error.  The Bad Request error indicated I needed to enter the name of the file...so apparently in the Destination File Path you can't simplly put http://www.mydomain/sites/library1/.  So how do I add the File Name?  Do I have to use the Name (dynamic content) selection? That gave me the 403 Forbidden error. 

 

I read somewhere or saw an example...that the Destination File Path was entered like this:  sites/library2/test.docx  If that is correct, that seems pretty difficult...I have to specify the file type (docx, xlsx, etc.).  

 

I'm hoping I'm missing something obvious and there is a way to use dynamic content (or someother way) to copy my file. 

 

2.  The other thing I would like to do is iterate through a library (If Condition where Doc Status = Published) with an "Apply to Each" following that would use the Copy File action to move all files where the Doc Status = Published to a new library. 

 

Thanks,

Bill

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @WillyD44,

 

The File path dynamic content could be achieved from output of "When a file is created in a folder" trigger of SharePoint connector, the output of "When a file is created or modified (properties only)" trigger doesn't contain File path dynamic content. You could consider take a try to change your trigger into "When a file is created in a folder".

 

The Path dynamic content could be achieved from output of "Get file metadata" action within later screenshots. In addition, the DisplayName dynamic content is also achieved from output of "Get file metadata" action.

 

I afraid that there is no way to designate a file path with ID or Link to Item in Microsoft Flow currently.

 

More details about triggers and actions of SharePoint connector, please check the following article:

SharePoint connector

 

Best regards,

Kris

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

View solution in original post

8 REPLIES 8
Highlighted
Community Support
Community Support

Hi @WillyD44,

 

For you first question, if you want to copy a file from one SharePoint library to another SharePoint library, I afraid that there is no way to use dynamic content to copy files in Microsoft Flow currently, because there is no dynamic content related to another SharePoint library could be chosen within Destination File Path field of “Copy file” action.

In addition, I don’t think your flow that you provided could achieve your needs. Please take a try with the following workaround:15.JPG

 The flow works successfully as below:16.JPG

 

For your second question, could you please show a bit more about Doc Status? Is it a custom column in SharePoint library?

I suppose that there is a custom column called Doc Status in your SharePoint library. Please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add “Get files (properties only)’ action, specify Site Address and Library Name.
  • Add a “Apply to each”, Input parameter set to output of “Get files (properties only)” action.
  • Within “Apply to each”, add a Condition, left input box set to Doc Status content of “Get files (properties only)” action, right input box set to Published, within middle drop down, select is equal to.
  • Within “If/yes” branch of “Condition”, add “Get file metadata” action, File Identifier set to Identifier content of “Get files (properties only)” action.
  • Add a “Copy file” action.

Image reference:17.JPG

 

18.JPG

The flow works successfully as below:19.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Thanks Kris. I will try and look at this later this week and get back to you. 

How did you get the FilePath dynamic content?  I do not have that option in my dynamic content section. 

Highlighted

In one of your later screenshots I also see just "Path", I'm not sure how you got that either.  I do not have that dynamic content either.

 

Is there any other way to designate a file path (can you use ID or Link to Item, etc.)?

 

thanks!

 

Highlighted

Hi @WillyD44,

 

The File path dynamic content could be achieved from output of "When a file is created in a folder" trigger of SharePoint connector, the output of "When a file is created or modified (properties only)" trigger doesn't contain File path dynamic content. You could consider take a try to change your trigger into "When a file is created in a folder".

 

The Path dynamic content could be achieved from output of "Get file metadata" action within later screenshots. In addition, the DisplayName dynamic content is also achieved from output of "Get file metadata" action.

 

I afraid that there is no way to designate a file path with ID or Link to Item in Microsoft Flow currently.

 

More details about triggers and actions of SharePoint connector, please check the following article:

SharePoint connector

 

Best regards,

Kris

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

View solution in original post

Highlighted

Thank you Kris.  What is the difference between Path and File Path?

Highlighted

Hi @WillyD44,

 

Both Path dynamic content and File Path dynamic content could represent the path of file, within the solution that I provided, the Path dynamic content and File Path dynamic content represent same path type: /SharePoint library folder/file name (has extension name).

 

The Path and File Path just are different display for the path of file within SharePoint library.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

I ended up using "Get file content" and "Create file", that's much more flexible

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

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