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.


Please follow and like us:


GR · July 4, 2018 at 15:43

Hello 🙂

Thanks for this!!

I have tried the same with your instructions and it works, except that it just creates the readme file and does not include the other files I attach to a list item. The flow shows a “success”. Also, when I add more than one file, it will not even create a readme as it says that there was no content, flow is still a success though.

Any idea why this happens?


    SharePointer · July 17, 2018 at 19:18

    Make sure you are adding ‘Attachment Content’ in the File Content area. I think this is because the file has no content.

Danielle · August 24, 2018 at 15:03

Trying to do something similar, except mine when item is created I start an approval, and when item is Response=Approved the list item is created in another below list. I want the attachments to move too, do you know how to move the attachment?

    SharePointer · September 16, 2018 at 20:50

    I don’t think there is an action to ‘move’ the item but you can copy the item/file.

Christopher J Crocker · September 23, 2018 at 06:10

I am having some difficulty creating the path for the compose task.

I have a Document library, and in that I have a folder called “RFP – Repository” and within that a subfolder “Active”

I would like attachments copied to the path: …/RFP – Repository/Active/

When I use /share documents/RFP – Repository/Active/ the flow fails. No readme created and no attachments copied.

Do I need to do something special to identify my folder path correctly? I cannot seem to get this right.

Christopher J Crocker · September 24, 2018 at 20:39

Hi, I have this partially working.

A problem I seem to have is when I add 5 mixed attachment types, an excel file, pdf, word etc, I end up with only the first file added to the list item when the form was submitted.

If I attach 5 files that are all excel files, I get a 5 files copied into the document library folder.
If I attache 5 pdfs…. I only get 2 of the files.

What could be causing this?

Cindy · October 16, 2018 at 14:12

Thanks so much for your help on this! I did find out where/how to create the “Create Folder by Creating a text file” but , like GR, it only created the Read me file and did not actually copy my attachments. Any idea what could be occurring?

When the flow failed it returned —
Get attachment content 3s – green check;
Compose 2 -0s – green check;
Create file 3 – 2s – green check;
Create file 4 – 0s, Red Explanation point.

I had three files attached to my original list item. Also, I “think” the “create file 3” is the readme text because that was, in fact, successful.

Thanks so much for your help!

SALVADOR LARA ROCHA · November 8, 2018 at 17:28

This also can be done on items already created? How can I go through the list?

    SharePointer · April 9, 2019 at 21:31

    You can create a manual or schedule action but remember if the size of the list if long you might run in the issues.

Jose Zaldivar · November 8, 2018 at 23:05

I had to make a few adjustments to this original code to work form me. I posted this screenshot below to show how I did it.
Basically, you create the folder first. Then you loop thru the attachments and place them in the folder. It works like a charm. If anyone wants to know the details, please reach out.

Olivier · November 21, 2018 at 19:50

Feel really stupid : when I want to use the “Get attachments” box, I can’t propose “ID” for the option is not in the list.

Leave a Reply

Your email address will not be published. Required fields are marked *