How to get PDF URL in SharePoint List from SharePoint Library using Power Automate

When files are uploaded to a SharePoint Library, there is often a need to store the file URLs in a
SharePoint List for tracking and relational purposes. The challenge lies in automating this process efficiently using Power Automate.

High level resolution steps

I. Prepare the SharePoint Environment:

  • Create a SharePoint List with a column to store file URLs.
  • Create a SharePoint Library to store uploaded files.

II. Automate the Process with Power Automate:

  • Build a flow to upload files, retrieve their URLs, and save them to the SharePoint List.

Detailed resolution steps on PDF URL in SharePoint List from SharePoint Library using Power Automate

Step 1: Setup SharePoint List and Library:
Create a SharePoint list named AttachmentsList with a column called File URL and set its type to Hyperlink. Add other necessary columns such as Title, Entity ID, and Entity Type to store related Data. Next, create a SharePoint library named Attachment Files to store the uploaded files.

Step 2: Create a Power Automate Flow:

  1. Start by creating an instant Power Automate flow using the Power Apps (V2) trigger. Add inputs
    for File Name, Account Name, Entity ID, Entity Type, and File Content.
Power Automate
  1. Add the Create File action to store the uploaded file in the SharePoint library. Set the Site Address to your SharePoint site, specify the Folder Path as /Attachment Files, and use dynamic content for the File Name (ensure you append .PDF to the name). Map the File Content to the corresponding input from Power Apps.
  1. Add the Get File Properties action to retrieve the file metadata. Set the Site Address to your SharePoint site and the Library Name to Attachment Files. Use the ID dynamic content from the Create File action to identify the specific file. “Itemid”
  1. Use the Create Item action to add a new item to the AttachmentsList. Set the Site Address to your SharePoint site and the List Name to AttachmentsList. Map the following fields:

Title: Use the Account Name input from Power Apps.
File Name: Use the File Name input from Power Apps.
Entity Type: Use the Entity Type input from Power Apps.
Entity ID: Use the Entity ID input from Power Apps.
File URL: Use the “Link to item” dynamic content from the Get File Properties action

Step 3: Save and Test the Flow
Save the flow and return to Power Apps. Test the flow by uploading a PDF file. Confirm that:

  • The file is successfully created in the Attachment Files library.
  • The AttachmentsList is updated with the file’s URL and corresponding metadata.

Output

  • Showing the result of File URL from the SharePoint Library