cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kpiana
Helper I
Helper I

Automated Flow Duplicate List Attachments to a Library

Hello Community,

 

I am trying to build a Automated Flow that will automatically duplicate attachments from a list to a Library. When ever a attachment is added or modified to the list it needs to update the same file and properties in the Library. Additionally it would need to copy the properties from the custom columns from the list to the columns in the library.

 

If you need any more information let me know. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

Hi @kpiana ,

 

It is difficult to implement if you want to synchronize the attachments contained in the List item to the Library and update the files that exist in the Library when the attachments are updated.

What I think can be achieved is to delete the corresponding file stored in the Library when the attachment is changed, and then re-save the attachment contained in the item to the Library and update the properties.

 

If you think this works, you can refer to the following method to configure Flow.

 

  • Here you need to create a column in the Library to form a correspondence with the List Item. The name of the field is ItemID and the type is Number.
  • Use Get files action to get the file, and use Filter Query to see if the attachments in the item have been synchronized. If not, save the attachment; if there is, delete the file first, then save the attachment again.
  • In the If no branch, the Apply to each 2 action needs to be configured, the remaining actions, you can copy the action inside If yes branch, they are all the same.
  • You only need to delete the Body in Apply to each 3 and then re-select it.

Image reference:

122.PNG

 

Best Regards,

Community Support Team _ Barry
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

5 REPLIES 5
v-bacao-msft
Community Support
Community Support

 

Hi @kpiana ,

 

It is difficult to implement if you want to synchronize the attachments contained in the List item to the Library and update the files that exist in the Library when the attachments are updated.

What I think can be achieved is to delete the corresponding file stored in the Library when the attachment is changed, and then re-save the attachment contained in the item to the Library and update the properties.

 

If you think this works, you can refer to the following method to configure Flow.

 

  • Here you need to create a column in the Library to form a correspondence with the List Item. The name of the field is ItemID and the type is Number.
  • Use Get files action to get the file, and use Filter Query to see if the attachments in the item have been synchronized. If not, save the attachment; if there is, delete the file first, then save the attachment again.
  • In the If no branch, the Apply to each 2 action needs to be configured, the remaining actions, you can copy the action inside If yes branch, they are all the same.
  • You only need to delete the Body in Apply to each 3 and then re-select it.

Image reference:

122.PNG

 

Best Regards,

Community Support Team _ Barry
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

Hello, and thank you for the response! I have it mostly put together but I am unclear with what you mean by "Here you need to create a column in the Library to form a correspondence with the List Item. The name of the field is ItemID and the type is Number.". Can you clarify this for me?

 

Additionally the 3 important columns that I need the properties copied over from the list and checked is: Last Modified, Last Revised Date(custom column), and Owner(Custom column).

 

 

This is a preview of the List (below)

Capture9.PNG

 

Hi @kpiana ,

 

I mean to create an additional relationship by creating an ItemID field in the SharePoint Library where you need to save the attachment to record the ID of the List item where the attachment is located.

 

Because you need to update the attachment, so we need to find the corresponding attachment by ItemID.

 

Hope it makes sense.

 

Best Regards,

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

Great, everything works. Thank you so much for all this help, the instructions where easy to understand and so much help. 

 

Bonus Question... How would I make it so that if a attachment/item from the list is deleted, how can I make it so that it will also delete it from the library. Since right now it will only replicate the actions of Creating and modifying from the list? 

 

Thank you

@v-bacao-msft 

 

Thanks again for all your help. One additional thing that I would like to know if it is possible to find a work around for... on the files that are created in the Library in this Flow, I have a link for each file that I post on the page site for our company. Now the problem is when ever the attachment is modified in the list and it deletes and creates a new one in the library, it breaks the URL even though the file and itemID is still the same.

 

Is there someway to make it so that the URL will always redirect to the same file that is associated with its unique itemID in the Library. 

 

Let me know if you need further clarification. Thank you!

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (2,608)