top of page

UPLOADING FILES TO SHAREPOINT WITH THE NEW POWERAPPS V2 CONNECTOR

Updated: Jul 21

Everyone needs to upload files from Power Apps to a data source. In this post we are going to walk through the steps of how to upload files to a SharePoint document library using the Power Apps attachment control and a quick Power Automate cloud flow.

Recently Microsoft updated the flow connector to v2. This means that uploading is easier, but it is different than we have done in the past. Below you will find the steps to upload a file from Power Apps. If you prefer to watch a demo, then check out the video for Power Apps Upload a file.

Let users upload files using the Attachment Control

The Power Apps attachment control is the best way to upload a file to your Power Apps app. The only problem is to get the control you have to steal it from a Form Control. 😐 So lets start there.

1.       Add any SharePoint list that has an attachment column as a data source to your app. Not the document library you want to use later, a list. 

2.       Now Insert an Edit form and connect it to that SharePoint list.

3.       Find the attachment control as shown below. Click on the control and copy it.

 


4.       Paste the control outside of the form. You will see some errors. Ignore those for now.

5.       Delete the form from your app and optionally you can remove the SharePoint list you added also.

6.       Go to the attachment control and fix all of the errors.

  • Clear the Items property so it is empty

  • Change the BorderColor to Color.Black

  • Clear the Tooltip property so it is empty

  • Set the DisplayMode to DisplayMode.Edit

Now your app is ready for your users to add files to the app.

Note: If you are having a hard time following along the video is much more detailed. Uploading files from Power Apps to SharePoint. This post assumes you have a solid understanding of Power Automate and Power Apps.

Create the Power Automate Upload Flow

The flow will accept the file from Power Apps, put it into your SharePoint Document Library, and set the file name.


1.       Create a new blank Power Automate Cloud flow. The following steps assume you have the new Power Automate Cloud flow studio, if you have the old studio, your steps will look different. The video shows both ways if you need it.

2.       Set the trigger to be PowerApps (v2).

3.       For your trigger add an input for File.

4.       Change the name ‘File Content’ to ‘MyFile’. Using a non-default name avoids confusion later.



5.       Add the SharePoint action Create File

6.       Set the Site Address to your SharePoint site.

7.       Set the Folder Path to the library and folder you want to upload to.

8.       Set the File Name to the Dynamic Content MyFile name



9.      Set the File Content to MyFile contentBytes

10.   Give your flow a name and save it. I used ‘Video Upload’ for my name.


Now that your flow is ready time to return to Power Apps to finish things up.


Add the flow to your Power Apps app

1.       Return to Power Apps and add your flow to the app.

2.       Go to the Attachment Control you added and set the OnAddFile property to

VideoUpload.Run("PAUpload", {file:{contentBytes:Last(Self.Attachments).Value, name:Last(Self.Attachments).Name}})

That will do it. Now when you add a file to the attachment control the flow will run and upload the file. Hooray! In the video we talk about things like creating a better user experience and we show how you can apply this to upload multiple files. That is too much for this post today though.


Summing it up

File uploads are a requirement of the business solutions we build for customers here at PowerApps911. If you need help implementing this or any other requirements in your app then scroll down to the Contact Us form below and reach out. We can do anything from a 30 minute screenshare to a 30 month project, just let us know what you need.

3,852 views0 comments

Opmerkingen


bottom of page