web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Downloading a PDF stor...
Power Apps
Answered

Downloading a PDF stored on SharePoint

(0) ShareShare
ReportReport
Posted on by 15

It is my understanding that the PDF viewer does not support viewing PDFs stored in a SharePoint library -- and the capability request has been in the development pipeline for a very long time (and I am not going to wait for it to happen).

 

In lieu of that ideal design, I'd like to give users the option to download a PDF file that is stored in a SharePoint library and am running into an issue where:

(1) the download works fine using the PowerApps "Preview the app (F5)" feature, but

(2) it gives an error when using mobile: "The URL passed to the function is not valid", and error1.png

(3) it fails when running in Dynamics 365, with the message "Failed - No file".

 Error2.JPG

My OnSelect [fx] function reads: 

 

Download(ThisItem.One_x0020_Pager)

 

Where ThisItem.One_x0020_Pager is a SharePoint list column containing a URL of a PDF stored in a SharePoint library.

Screenshot1.JPG

 

Am I doing something wrong here, or is downloading from SharePoint libs also unsupported??

Categories:
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @grhaberer,

     

    I just tested and got the same result as yours. Notice that the URL of SharePoint library files was something like "https://xxxx.sharepoint.com/sites/TeamSite/Library1/test2.xlsx". The URL has to specify the file extension as the http://path. 

     

    This will work on a desktop, after clicking on the button, user is prompted for a location to save the file. 

    But on mobile, it will show the error. (Sorry that my mobile system is in Chinese version.)

    Capture.PNG

     

    I will report this to the pg and see if they have any suggestion. Thanks for pointing this out.

     

    Regards,

    Mona

  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @grhaberer,

     

    I should also mention that I cannot reproduce your issue about the Dynamics 365 site part. When I use the app from web browser, with excel/word file, the browser will pop up the option to download the file, but with PDF file, it will directly open the PDF file.

     

    Formula I'm using:

    Download(ThisItem.SharePointSiteURL)

     

    Regards,

    Mona

  • Verified answer
    v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @grhaberer,

     

    This is by design.

     

    It works on Desktop as the user may be logged into the browser already and hence the url works. This will not work on mobile as PowerApps doesn’t know how to get the file from SharePoint.

     

    You have two options:

    1. Add the file as an attachment to a list item and use the attachment control.
    2. Try to use the Launch() function, it may work on mobile as well.

     

    Regards,

    Mona

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-monli-msft

     

    This used to work on my Android device, but has since stopped working.

     

    I have a SharePoint online document library with PDFs stored in it. There are a number of meta data fields on each file. I have a PowerApp with a view gallery which is loading rows from the library. By including a PDF image on each gallery item I am able to use the OnSelect action on the image combined with the Launch(ThisItem.'{Link}') function to launch the browser and open the file in the browser. For months this was working but recently this has stopped (so far on Android, this doesn't seem to be an issue on iOS).

     

    Now when attempting to launch the file, it starts to open and either;

    1. attempts to open in a PDF viewer which fails with the error: "Cannot display pdf (filename.pdf can not be opened)"

    2. attempts to open in a PDF viewer which fails with the error: "Error. The file could not be downloaded. Please save the file to your local strorage and then try to open it."

    3. loads it in the browser which then downloads the file locally without displaying it

     

    Is there any way that this behaviour can be changed? I desperately need the files to be accessible on mobile and they need to open in the browser (if the PDF viewer isn't going to support SharePoint or OneDrive files).  

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
    I have same issue and have nothing to add to your descriotion but to the fact that it does work fibe on desktop ibside PA studio online , while on Android not

    And the minute the app is fired up to my android , i get the red strip aboce the app with an error message
    Unknown error
  • Office365Master Profile Picture
    338 on at
    You could alternatively leverage the technique using a "very" simple Flow I described in a recent blog: https://masteroffice365.com/viewing-pdfs-from-sharepoint-within-powerapps/ The downside of this technique though is that there is no way to print the PDF using the PDFViewer control so that kinda sucks...
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    But PDF is open in browser then getting download option, we can not directly save PDF file in our local system?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Anyone got the solution to download the pdf directly on button click instead of opening in browser?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard