Create file from attachments

Move list item attachments to Document Libraries with Microsoft Flow

Today an easy set of steps to for the creation of files when you receive list items with attachments. Ho do we get those file from the list items copied into a document library.

Triggering the flow when an item arrives

To trigger the flow we can use the When an item is created or modified trigger. Then using the Get attachments it is easy to get all the attachments for the list item that was created.

Get Attachment

Now that we have the attachments. Note that we can get more than one attachment.

We will need to get the content of each attachment. With the content we can create a file in  document library of choice.



Create Files

To get the file name the same as used within the attachment the DisplayName can be used. The DisplayName is available within the  Dynamic content coming from the Get Attachment Content action.

Once the above steps are added to the flow my file is created.

Create file from attachment


4 thoughts on “Move list item attachments to Document Libraries with Microsoft Flow

  1. commented on September 9, 2019 by Joseph

    How can this be modified to 1st check to see if the Document Library already has the file (by DisplayName or other meta data), and if NOT, then create per flow, ELSE do not create a new document library item, but instead, replace the file with this new one.

    Currently, using the flow above, I end up with duplicates all over my Document Library whenever duplicate items are saves to my sharepoint list.

  2. commented on April 10, 2020 by Lily

    Thanks a lot, I implemented this already. Now, I’m wondering when a document is deleted from my SP List, how to run a MS flow to delete that file from the document library. I tried to use the same logic as creating, but I couldn’t figure it out.

    • You could use the when an item is deleted trigger.

      When you create the document fromt ge attachment set a property on the document to the id of the list item.

      Now you can use the item id to delete the matching documents.

      Does that work for you?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: