cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Downloading files from Sharepoint in PowerApp

Hi All,

 

I have created a PowerApp which lists files (mainly pdf files) located in Sharepoint using a Gallery Control.

Using PowerApps' Download(url) function with the Sharepoint Files 'Link to Item' I'm about to pop open this file into a new tab on the click of a button.

Is there a way to configure this so the file will just be downloaded on the click of a button immediately instead of opening in a new tab.

I've tried the above mentioned method and even the PDF Viewer control but both of those require the file to be opened in a new tab, then they are downloadable.

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@Po5,

Could you please share your formula within the Download() function?

I have found that if you create a custom library to store files, you could use the following link to download directly:

Download("https://<site URL>/_layouts/download.aspx?SourceUrl=/sites/sitename/libraryname/filename.pdf")

This is an alternative solution that you should create a library to rename it as a custom library.

I have made a test that if you use the Documents by default as the Library to store your PDF files, there is no way to download the files directly clicking the download button. And for investigating, I recommend you open a ticket here. This will make you full understand why this link could not be used when you store your PDF files in the default library in SharePoint site.

Hope it could help you.

Regards,

Qi

View solution in original post

4 REPLIES 4
Community Support
Community Support

Hi@Po5,

Based on the issue that you mentioned, do you want to download the PDF files directly from the SharePoint library?

Could you please share a bit more about the scenario?

Actually, the Download() function will make you download from the web to the local. It is by design that we could not avoid this when downloading.

In native players (Windows, Android, and iOS), the user is prompted for a location to save the file.

Your browser settings determine whether to download the file or open the file directly in a new tab.

For more details, please check Download function for reference.

In a word, I am afraid there is no way to download files directly without opening a new web in PowerApps currently.

Here is a similar idea you can refer to:

PowerApps Download file button (working or not)? - Power Platform Community (microsoft.com)

Hope it helps.

Regards,

Qi

Hi Qi,

 

Yes that's correct, at the moment I'm using the Sharepoint Connector and displaying a Gallery of items (which are the items in the Sharepoint Library). At the end of each row I've added a button that runs Download(ThisItem.'Link To File') when the button is selected.
ThisItem.'Link To File' gives a URL to the file in Sharepoint, an example would be https://mysp.sharepoint.com/sites/mylibrary/file.pdf.
What I'm looking for is a way to actually download the file on select of the button instead of it opening in a new tab and having the user download it from a different page (in essence this is an extra unneeded step).
At the moment let's limit this to web and take Windows, Android, iOS out of the equation.
I'm aware that there is also a Launch() function which effectively does the same thing as what's currently happening with Download() so just looking for alternatives so when the users using the app click download it actually downloads on first click.

 

Cheers

Hi@Po5,

Could you please share your formula within the Download() function?

I have found that if you create a custom library to store files, you could use the following link to download directly:

Download("https://<site URL>/_layouts/download.aspx?SourceUrl=/sites/sitename/libraryname/filename.pdf")

This is an alternative solution that you should create a library to rename it as a custom library.

I have made a test that if you use the Documents by default as the Library to store your PDF files, there is no way to download the files directly clicking the download button. And for investigating, I recommend you open a ticket here. This will make you full understand why this link could not be used when you store your PDF files in the default library in SharePoint site.

Hope it could help you.

Regards,

Qi

View solution in original post

That workaround worked perfectly for me thanks!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (21,088)