Copy SharePoint list attachment (s) to a document library using Microsoft Flow
This one is simple, yet very powerful and was only possible with the power of Microsoft Flow. I did something similar in SharePoint 2010 and it took me at least two days to learn and implement, but with the Flow, I have a working solution ready within 30 mins.
The requirement was, user will submit a form with some attachments and these attachments/ documents will need to be reviewed and processed. Reviewing individual files in the custom list could be very tedious (clicking one by one files) and we also don’t get the same experience as the modern library with preview etc. It also allows the admin staff to share file easily during the review stage if needed. We can also send multiple attachments via email using an Array action.
The Flow will trigger when an item is created in a particular list. The first action would be get the attachments from a particular item submitted.
Next, we will loop through all the content of the attachments of the particular item.
I wanted to create a folder per item with the name of the User Name and ID (in case, there are users with the same name). So we have compose action which gives us a path and in order to create a folder (as there is no create folder action available) we have to create an empty text file. This can be deleted, if required, but I keep this.
Last step is to create the files in the particular folder created above. In my case, I have also decided to copy the files into a different site collection. Yes, a different collection, imagine doing this with the SharePoint Designer!
Let’s run this by adding an item in the list. I have four attachments submitted with this item.
All the attachment submitted were copied in a new folder called User Name – ID (SharePointer-30), I am using a default ID provided by the custom list as it is auto numbered and unique.