How to Save SharePoint List Attachments to a SharePoint Library Using Power Automate?

While working on Power Automate, I was required to manually save attachments from a SharePoint list into a SharePoint document library. The goal was that when an item was created in the SharePoint list, any attachments should be automatically saved into a specific SharePoint library. And yes, of course, we can achieve this using Power Automate.

However, another requirement came: the attachments needed to be stored in a folder within the library, with the folder named using a combination of the item’s title, ID, and the current year.

In this tutorial, I will show you how to save SharePoint list attachments to a SharePoint library using Power Automate and store them in a folder within that library.

Save SharePoint List Attachments to a SharePoint Library Using Power Automate

For this example, I created a SharePoint list of Employee Requests using the below column and data types:

ColumnData Types
Request TitleSingle line of text (Title)
Requester NamePerson or Group
Request DateDate and time
Request StatusChoice
Request DescriptionMultiple lines of text
Attachmentshyperlink
Power Automate Save Attachments To SharePoint Library

I also created a SharePoint library, which is Request Attachments:

How do I add an attachment from SharePoint to Power Automate

1. Create an automated cloud flow. Give the flow name and select the trigger When an item is created. Also, provide the Site Address and List Name.

How do I add an attachment to a SharePoint library using power Automate

2. Now, I need to add a condition action that checks whether this item has any attachments or not. To do this, I added a condition to select the Has attachment (from When an item is created dynamic content) is equal to true (From expression).

How to Save Sharepoint attachments to SharePoint with PowerAutomate

3. Inside the true section, add the get attachment action with the below parameter:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Name: Choose a particular list.
  • Id: Select Id from dynamic content under When an item is created.
Save SharePoint attachments to SharePoint library with Power Automate

4. After that, take the Get attachment content action to retrieve the details from the attachment. Then, Provide the below parameters:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Name: Choose a particular list.
  • Id: Select Id from dynamic content under When an item is created.
  • File Identifier: Take Id from the dynamic content of Get attachments.

You can see that a For each loop will be added automatically, taking Body outputs from Get attachments.

How to Save SharePoint Attachments in SharePoint library with Power Automate

5. Inside for each loop, add a create file action, which creates a file in the sharepoint library. To do this, I added a create file action  with the below Parameters:

  • Site Address: Choose the SharePoint site from the dropdown.
  • Folder Path: Select the folder from the Show Picker where you want to store the copied files.
  • File Name: Use the dynamic content value ‘Name’ for the file name.
  • File Content: Add the ‘File content’ from the dynamic content.
Power Automate save SharePoint list attachment to SharePoint library

Once the flow is ready, we will move forward with running it.

Run flow to Save SharePoint List Attachments to a SharePoint Library

Now click on Save and run the Flow manually. Then, add an item with an attachment to the SharePoint list.

Power Automate Save Attachments in SharePoint Library from List

After the flow runs successfully, go to the SharePoint library, and you will see that the file has been created.

How to Save Sharepoint Attachments to a SharePoint Document library using Power Automate

You can Save SharePoint Attachments in a SharePoint library using Power Automate.

Save SharePoint List Attachments to a SharePoint Library Folder Using Power Automate

I hope you create the flow mentioned above. I will then edit the flow and show how we can save SharePoint attachments to a folder in a SharePoint library.

Edit the above flow, and after the get attachment action, add a Create new folder action with the below parameter:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Or Library: Choose a particular library where you want to create a folder.
  • Folder Path: here, according to my requirement (item’s title, its ID, and the current year), I give the below expression:
concat(triggerBody()?['Title'],'-',triggerBody()?['ID'],'-',formatDateTime(utcNow(),'yyyy'))

This formula takes the ‘Title’, ‘ID’, and the current year, and combines them into one string with dashes between them. For example, if the ‘Title’ is “Report”, the ‘ID’ is “123”, and the current year is 2024, the result would be: “Report-123-2024

Save a SharePoint Attachment to a Folder in a SharePoint Library using Power Automate

Then click on the create file action and delete the Folder Path. After that, provide the below expression:

concat(body('Create_new_folder')?['{Path}'],'/',concat(triggerBody()?['Title'],'-',triggerBody()?['ID'],'-',formatDateTime(utcNow(),'yyyy')))

This formula combines the base folder path with a newly constructed folder name. For example, if the base folder path is /Documents/Reports, the ‘Title’ is “Report”, the ‘ID’ is “123”, and the current year is 2024, the resulting folder path will be: /Documents/Reports/Report-123-2024

How to Save a SharePoint Attachment to a Folder in a SharePoint Library using Power Automate

Then, save the flow, and we will continue running it.

Run the Flow to Save SharePoint List Attachments to a SharePoint Library Folder

Now click on Save and run the Flow manually. Then, add an item with an attachment to the SharePoint list.

Power Automate Save a SharePoint Attachment to a Folder in a SharePoint Library

After the flow runs successfully, go to the SharePoint library, and you will see that the Folder has been created. Then, when you open that folder, you can see the attachment files.

Power Automate Save a SharePoint list Attachment to a Folder in a SharePoint Library

I hope you follow all the steps to Save a SharePoint Attachment to a Folder in a SharePoint Library using Power Automate.

Related Power Automate tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…