How to create flow to copy files from one SP site to another when certain metadata tag is used

Brass Contributor

Hi, this seems like it should be pretty straight forward to me, but I can't seem to figure it out with the newest GUI of PowerAutomate Flow. 

 

How can I copy a file from one site to another SP site (to a certain folder) when a specific metadata tag is used? e.g., I want to copy a file from SP Site #1 when this "Closeout - As-Builts" tag is used to SP Site #2 to Subfolder #1 

 

2024-01-04_14-00-44.png

 

Another portion of my question would be, is it possible to have the flow look across ALL of our sites that have a "Construction & Development" library for this specification? Or do I need to create a separate flow for all 20 of our Property sites for this to work?

Thank you in advance! 

Morghan C.

7 Replies

Hi @mdcastorena , if consolidating to a single site and document library isn't possible you could consider a basic Flow on each which updates a central list with and changes from across all sites.  The simple Flows would update the list with the source site detail, document detail and the change. Then, a single 'master' Flow would monitor changes to the list and evaluate the change in the Document Type attribute. If it meets your criteria it would then use the list metadata to move the file to the correct location.

I haven't built an example but that is how I might first approach the problem.

Hi @Jon_Lake - thank you for the response. 

 

I think I need more help with the first question before being able to wrap my mind around automating it across all sites. 

 

With that said, let me ask the question this way -

 

I upload Test File to Doc Lib 1 on Site 1 which is using Content Type "Document Type" in column 2. 

I want to take any file uploaded and tagged as "Closeout - As-Builts" to Doc Lib 2 on Site 2. 

Doc Lib 2 on Site 2 is NOT using content types (we don't need them - we just want the document copied over). Screenshots below --

 

Doc 1 Site 1 on the left. When file is uploaded, and Document Type "Closeout - As-Builts" is applied, copy to Doc 2 on Site 2:

 

screenshot-1.png

 

I tested by clicking Upload > Files from Doc Lib 1 Site 1:

 

screenshot-2.png

 

I upload "Test Doc 6.docx" to Doc Lib 1 to Site 1 and apply the Document Type (Content Type) "Closeout - As-Builts":

screenshot-3.png

 

However, when I run a test with my flow, I get a message that the condition has not been met:

4creenshot-3.png

 

For reference, here is what I have so far in my Flow... I must not be doing something right:

 

flow-test.png

Hi @mdcastorena , I set up a test source folder and destination folder. I set my document type attribute using a choice field but that's not a requirement. It looked like this for the sake of testing.

 

test_folders.png

 

I then use the 'Move file' action in the yes path of my condition. In testing it successfully moves the two qualifying files.


flow.png

 

The files move with their attributes. I didn't create the document_type field in the destination folder, it was created automatically.


result.png

Hi @Jon_Lake  - 

 

Thank you for the response! I want to keep the original file in Doc Lib 1 Site 1 and just copy the file to Doc lib 2 Site 2. Is that possible? Does your test keep the original file in it's source lib? 

Hi @mdcastorena , yes you can copy the file rather than move it.

copy_file.png

Hi @Jon_Lake  - Can you please explain what Dynamic Content you're using in the first two steps (before the "For Each" step)? That is where I am getting stuck now (also, can you confirm I am using the correct trigger and Get File action? Sorry for so many questions; it has been a very long time since I've worked with Flow): 

 

01.10.2024.png

 

Thank you for your assistance! 

Hi @mdcastorena , I simplified the Flow. If I update the document attribute accordingly it works well.

 

copy_file.png