Get SharePoint List Attachments Using Power Automate REST API

I was working on an IT Help Desk application where I faced an interesting challenge.

We were using the Power Automate REST API to get data from a SharePoint list and display it in a Power App.

Now, our SharePoint list also has attachments, and when the flow returned all the records, we wanted those attachments to show up too.

But we didn’t want the actual file content; we only needed the ServerRelativeUrl of each attachment.

That way, in Power Apps, we could use the Launch() function to open the attachment directly without storing the file content in the app.

So, in this tutorial, I’ll show you how to retrieve attachments (and their URLs) from a SharePoint list using the REST API in Power Automate.

Get SharePoint List Attachments with REST API

For this example, I’ve created a SharePoint list containing a few sample items, each with attachments.

get the attachement files from REST API

Now, follow the steps below:

  1. Go to Power Automate and click Create -> Instant Cloud Flow. Select When Power Apps calls a flow (V2) trigger.
Power Automate flow retrieving SharePoint list attachments using REST API
  1. Then add a Send an HTTP request to SharePoint action from sharePoint Connector with the below parameter:
_api/web/lists/getbytitle('Task Tracker')/items?$expand=AttachmentFiles&$select=ID,Title,AttachmentFiles

Here:

  • $expand=AttachmentFiles: This expands the attachments collection for each list item.
  • $select=ID,Title,AttachmentFiles: This specifies the fields you want to retrieve, including attachments.
Example of using REST API in Power Automate to get SharePoint list attachments
  1. Then add a Respond to a Power App or flow action, and add an output to give the name and pass the below expression:
body('Send_an_HTTP_request_to_SharePoint')?['d']?['Results'] 
extract SharePoint list item attachments using REST API call

Run Flow and Check Output

Click “Save” in the top-right corner of the Flow Designer. Click Test -> Manually -> Run flow. Once the flow runs successfully, you can see the result by clicking the Send an HTTP request to SharePoint action. Under Outputs, expand Body.

Get SharePoint List Attachments with REST API Using Power Automate

You can now pass this data back to your Power App and use the Launch() function with the ServerRelativeUrl to open the attachment directly.

You may also like the following tutorials:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

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