Copy attachment of a list to library

Copper Contributor

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

 

8 Replies
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.

Hi @Swaminathan Sriram,

 

I tried with Power Automate but I cannot recover the contents of the file.

 

Thanks

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

0-SP-listAttachment.png

 

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.

 

1-trigger-getItems-A2E.png

 

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.

2-condition-getAttachments.png

 

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.

 

3-compose-createFile.png

 

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

 

4-SP-Result.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

Thanks @RobElliott 

 

I did as requested but I have the impression that it cannot find the attachments saved in the list...

The flow does not indicate an error.

 

Thanks

 

 

@Ben423  can you post  screenshots of your flow?

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

Hi @RobElliott,

 

Here is screenshots,

 

Capture 1.JPGCapture 2.JPG

Capture 3.JPG

@Ben423 your condition has Oui as the criteria which I think is incorrect. In English it is Has Attachments is equal to true so in French that would be vrai.

 

I'll look at the rest of it but that was the first thing I saw,

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

 

I wrote "Vrai" and it's the same thing...