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

Issue with Copy File - Sharepoint Library to Sharepoint Library

Afternoon all,

I have been working on an archive document flow which based on a column choice menu option copies a document from one SharePoint Library to another (same site) before deleting the original document from the source library. I have hit a problem that I am hoping the community can help with.

Flow user process explanation below:

  1. User changes column choice to ‘Archive’
  2. Flow triggers
  3. Copies file and metadata to archive library
  4. Emails users of file move
  5. Deletes file in source library
  6. Flow ends  

Issue: I can get the file to successfully copy but if the user changes multiple files to Archive at once the flow runs for each Archived document and copies collectively against every document tagged as archived. So i end up with the flow creating multiple versions of the same document for each time the flow has been triggered.

Can anyone let me know where I am going wrong?

Flow 1.pngFlow 2.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @BenFlow ,

to copy metadata from the original file to the copy, add the 'Update file properties' action and update the copied file using the metadata from the original file. The 'Copy file' will give you Id of the new file as an output and 'Get files (properties only)' will provide you the metadata in output.

One observation: you're using 'Get files (properties only)' to get the file properties. This action can return multiple files (if they fit the action configuration), and I think that's the reason why it created multiple files before, it was looping for each of the files found. I'd use just 'Get file properties' to get properties only from the file that triggered the flow.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
BenFlow
Frequent Visitor

I have rebuilt the Flow with the following and it seems to have done the trick. Now need to figure out how to copy across metadata when the file copies 😩

Flow 3.pngFlow 4.png

 

 

Hello @BenFlow ,

to copy metadata from the original file to the copy, add the 'Update file properties' action and update the copied file using the metadata from the original file. The 'Copy file' will give you Id of the new file as an output and 'Get files (properties only)' will provide you the metadata in output.

One observation: you're using 'Get files (properties only)' to get the file properties. This action can return multiple files (if they fit the action configuration), and I think that's the reason why it created multiple files before, it was looping for each of the files found. I'd use just 'Get file properties' to get properties only from the file that triggered the flow.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
BenFlow
Frequent Visitor

@tom_rihaApologies for delay in responding. Thank you so much for you reply. I have implemented the changes you suggested and it works a treat. I hit an issue with a lookup column when doing the update file properties stage but it was due to the flow needing to retrieve the ID of the item in the list.

Unfortunately realised that the automatic flow will only run as the flow creator - do you know of a way to update this without changing it to a manual trigger?

Below is the updated flow i have implemented with your help - thank you:

Archiveflow1.pngArchiveflow2.png

 

Hello @BenFlow ,

automated flow will run using the connection that's defined in the actions. It must be an existing account, so if it shouldn't be your account then you must replace it in the actions (3 dots, connection at the bottom) with another one, ideally a 'service' account created specially for the flow.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,593)