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
The best answer, the previous one is fine but for some reason it did not allow me to download, but this was the best option for me, I thank you
Hi Habib,
I think it is an even better solution to just add the ?Download=1 tag at the end of the link in the Download/Launch functions.
It could be easily used in Galleries as
Download($"{ThisItem.'Link to item'}?Download=1")
Kudos for bringing this up.
Update: I just realized this method does not pop up the download screen for all filetypes, some will be opened in browser.
Upon clicking a download button in PowerApp I had to create a file in Sharepoint through MS Flow and return a download link to download it. By default Sharepoint "Create sharing link for a file or folder" item doesn't provide a direct download link instead it provides a link to edit or view the file. So I couldn't download my file. Then I found the given resource and according to the suggestion I added "?Download=1" at the end of the "View and edit" link. It solved my problem.
In PowerApps, I put the following lines OnSelect a download button.
Set(Downloadlink, FlowName.Run(data)).filelink);Download(Downloadlink)
That workaround worked perfectly for me thanks!
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
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,
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
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional