Forum Discussion

Ben423's avatar
Ben423
Copper Contributor
Mar 30, 2020

Copy attachment of a list to library

Hi,

I have a list of over 300 items and I would like to transform it into a library or at least switch the attachments. How can I do it ?

 

Thans for your help

 

  • Hi,
    I presume that you're looking for SharePoint Online -> You could utilize Power Automate to create a Flow which uses the "Manually trigger a Flow" trigger and add "Get Items" action of SharePoint connector and using "Create File" of SharePoint connector, you can copy the attachments from a SharePoint list to library.
    Ben423.
    Thanks.
      • RobElliott's avatar
        RobElliott
        Silver Contributor

        Ben423  hopefully this will help. In this example we will copy the bell-pepper3.jpg attachment from a list to the Documents Library.

         

        I've started with a manual trigger but you could use a recurrence schedule if you wanted it to copy items every day for example. The first action is a SharePoint Get items to get all the items from the list. Next, add an Apply to each control and select value from the dynamic content box.

         

         

        Then add a condition of Has attachments is equal to true. Leave the red If no channel empty. In the 

        green If Yes channel add a SharePoint Get attachments action, selecting ID from the dynamic content. Next add a SharePoint Get attachment content action, selecting ID and Identifier from the dynamic content.

         

        Add a SharePoint Create file action. It will wrap itself in an Apply to each control.  Make sure for the File Name field that you select DisplayName from the Get attachments section of the dynamic content. For the File Content field select Attachment Content from the Get attachments section of the dynamic content.

         

         

        When you run the flow each attachment will be created in the documents library:

         

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User

Resources