Tutorials/Power Apps/Streamline File Uploads to SharePoint with Power Apps and Power Automate V2 Trigger
Power Appsintermediate

Streamline File Uploads to SharePoint with Power Apps and Power Automate V2 Trigger

Learn how to attach files in Power Apps and automatically upload them to a SharePoint document library along with custom metadata.

NA
Narmer Abader
@narmer · Published June 3, 2026

Uploading documents to a SharePoint document library directly from Power Apps has historically required complex workarounds to convert files between Base64 and binary formats. With the introduction of the Power Apps (V2) trigger in Power Automate, that process is now streamlined: the trigger natively supports the file data type as an input. This guide shows you how to build a Power Apps interface for attaching files and sending them to a SharePoint document library, together with custom metadata that keeps everything organized.

Scenario: Employee Onboarding Offer Letter App

Imagine an HR department that needs to collect signed offer letters from new hires. Rather than relying on email or manual network drives, they use a Power App to upload the PDF and tag it with employee details such as name, job title, start date, and department. The app uploads each file to a SharePoint document library called OfferLetters, where the metadata makes it easy to search and audit the records.

1. Prepare the SharePoint Document Library

Create a new document library named OfferLetters in your SharePoint site, then add the following custom columns:

Column NameData Type
EmployeeNameSingle line of text
JobTitleSingle line of text
StartDateDate only
DepartmentChoice (e.g., Engineering, Sales, HR)

After setting up the library, you can optionally create a folder path (e.g., /OfferLetters/2026) to organise files by year.

2. Build the Power Apps Screen

Open Power Apps and create a new app from blank. Design a simple screen with a title, a few text input boxes, a DatePicker, and a button that will trigger the upload.

Insert the Attachments Control

The attachments control is not directly available from the "Insert" menu; you need to generate it through a temporary SharePoint list:

  1. From the data pane, connect to any existing SharePoint list on your site (not the document library).
  2. Insert an Edit form control, set its DataSource to that list, and confirm that the attachments field appears automatically. If it doesn’t, add it from the “Edit fields” pane.
  3. Select the attachments control (the paperclip icon), cut it, and paste it outside the form. Delete the form.
  4. Delete the temporary SharePoint connection – it is no longer needed.

Now set the following properties on the pasted attachments control:

powerfxAttachments Control Properties
DisplayMode: DisplayMode.Edit
MaxAttachments: 1
Items: Blank()

For this walkthrough we will keep MaxAttachments at 1; you can increase it later if you need multi-file uploads.

3. Create the Power Automate Flow

Go to the Power Automate action inside Power Apps and select “Create a new flow”. Choose the Power Apps button template. Delete the default trigger and replace it with Power Apps (V2) – this version accepts file inputs.

Configure the Trigger

  1. Click Add an input and select File.
  2. Name the input DocumentContent and mark it as required.

Add the SharePoint “Create File” Action

Add a Create file action from the SharePoint connector. Fill in the site address and folder path for your document library. For the File content field, select the file from the dynamic content list (it appears as file from the trigger).

The File name field requires an expression – open the expression editor and paste:

jsonFile Name Expression
triggerBody()['file']['name']

Now add three more inputs to the trigger: Text inputs named EmployeeName, JobTitle, and Department, plus a Date input named StartDate. Each should be required. After the “Create file” action, add a Update file properties action from SharePoint. Map its fields to the trigger inputs as follows:

PropertyValue
EmployeeNametriggerBody()['file']['EmployeeName']
JobTitletriggerBody()['file']['JobTitle']
StartDatetriggerBody()['file']['StartDate']
DepartmenttriggerBody()['file']['Department']

Save and name the flow UploadOfferLetterToDocLib.

4. Connect the Flow and Upload with Metadata

Back in Power Apps, add a Button control. With the button selected, open the Power Automate pane and choose the UploadOfferLetterToDocLib flow – it will appear in the data sources.

Set the button’s OnSelect property to:

powerfxUpload Button OnSelect
UploadOfferLetterToDocLib.Run(
  {
      contentBytes: First(att_OfferLetter_Attach.Attachments).Value,
      name: First(att_OfferLetter_Attach.Attachments).Name
  },
  txt_EmployeeName.Text,
  txt_JobTitle.Text,
  txt_Department.Text,
  Text(dtp_StartDate.SelectedDate, "yyyy-mm-dd")
)

The first argument contains the file data (the attachment’s binary content and its name). The subsequent parameters are the metadata values in the same order they appear in the flow inputs.

Required Inputs

If you receive an error when the flow runs, double‑check that all inputs in the flow trigger are marked required. Also verify that the metadata column names in the “Update file properties” action exactly match those in the SharePoint document library.

Now test the app: attach a PDF, enter employee details, and click the button. After a few seconds the file should appear in the OfferLetters library with the metadata filled in.

5. (Optional) Upload Multiple Files

To support uploading several attachments at once, change the attachments control’s MaxAttachments to a higher number (e.g., 5). Then replace the single‑file code in OnSelect with a ForAll loop:

powerfxMulti-File Upload OnSelect
ForAll(
  att_OfferLetter_Attach.Attachments As Attachment,
  UploadOfferLetterToDocLib.Run(
      {
          contentBytes: Attachment.Value,
          name: Attachment.Name
      },
      txt_EmployeeName.Text,
      txt_JobTitle.Text,
      txt_Department.Text,
      Text(dtp_StartDate.SelectedDate, "yyyy-mm-dd")
  )
)

Note that flow runs are sequential for each file, which may take longer if many large files are attached.

6. Display Recently Uploaded Files

To give HR staff visibility of recent uploads, add a Vertical gallery to the screen. Set the gallery’s DataSource to the OfferLetters document library, and configure the Items property to show newest‑first:

powerfxGallery Items Sort
Sort(OfferLetters, Modified, SortOrder.Descending)

Inside the gallery, use two labels:

  • Name: ThisItem.Name
  • Modified: ThisItem.Modified

The gallery will automatically refresh after each new upload.

Security, Performance & Delegation Notes

  • Authentication: The flow runs under the credentials of the app user (unless you switch to a specific connection in the flow settings). Ensure users have at least Contribute permissions to the document library.
  • File size limit: The Power Apps file data type can handle files up to 20 MB. For larger files, consider splitting them or using a dedicated Azure service.
  • Delegation: The Sort function on SharePoint document libraries is delegable for the Modified field, but custom columns may not be – test performance with large libraries.
  • Error handling: You can wrap the Run call in an If or Switch to catch flow errors, but that is outside the scope of this basic pattern.

Common Mistakes & Troubleshooting

ProblemMost Likely Cause
“The parameter is incorrect” when running the flowThe contentBytes is not being passed or the flow input is not marked required.
File uploads but metadata is emptyThe “Update file properties” action is missing or the property names are misspelled.
Date appears as a number or wrong formatEnsure you are using Text(…) with the "yyyy-mm-dd" format string in Power Apps.
Attachments control does not appearDid you use a temporary SharePoint list connection? The list must have attachments enabled (they are enabled by default).

Final Recommendation

The Power Apps (V2) trigger removes the most cumbersome part of file uploads – manual encoding and decoding. With this pattern you can quickly build an app that sends files to SharePoint and attaches accompanying metadata. For production apps, consider adding loading indicators, duplicate‑file checks, and a confirmation message after each upload.

References