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

Downloading a PDF stored on SharePoint

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??

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

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 Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Highlighted
Community Support
Community Support

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

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support
Community Support

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

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support
Community Support

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 Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

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).  

Highlighted
Anonymous
Not applicable

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
Advocate V
Advocate V

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...

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,363)