I'm trying to copy a file in SharePoint from one library to another. I'm having trouble with 2 things:
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
Solved! Go to Solution.
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:
Best regards,
Kris
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:
The flow works successfully as below:
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:
Image reference:
The flow works successfully as below:
Best regards,
Kris
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.
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!
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:
Best regards,
Kris
Thank you Kris. What is the difference between Path and File Path?
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
I ended up using "Get file content" and "Create file", that's much more flexible
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
86 | |
57 | |
40 | |
35 | |
33 |
User | Count |
---|---|
79 | |
67 | |
57 | |
49 | |
40 |