Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Downloading files from Sharepoint in PowerApp

Like (0) ShareShare
ReportReport
Posted on 27 Jan 2021 20:21:57 by 17

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

Categories:
  • MasterRA Profile Picture
    66 on 27 Jun 2024 at 20:40:34
    Re: Downloading files from Sharepoint in PowerApp

    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

  • Koczek Profile Picture
    20 on 31 Aug 2023 at 09:27:46
    Re: Downloading files from Sharepoint in PowerApp

    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.

  • habib6093 Profile Picture
    39 on 18 Jun 2021 at 08:20:09
    Re: Downloading files from Sharepoint in PowerApp

    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.  

    habib6093_0-1624004306263.png


    In PowerApps, I put the following lines OnSelect a download button.

    Set(Downloadlink, FlowName.Run(data)).filelink);Download(Downloadlink)




    https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/38373310-direct-download-link-for-end-users 

  • Po5 Profile Picture
    17 on 01 Feb 2021 at 21:53:27
    Re: Downloading files from Sharepoint in PowerApp

    That workaround worked perfectly for me thanks!

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 01 Feb 2021 at 04:59:27
    Re: Downloading files from Sharepoint in PowerApp

    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

  • Po5 Profile Picture
    17 on 29 Jan 2021 at 00:37:53
    Re: Downloading files from Sharepoint in PowerApp

    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

  • v-qiaqi@microsoft.com Profile Picture
    on 28 Jan 2021 at 05:12:58
    Re: Downloading files from Sharepoint in PowerApp

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard