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

Getting PDF Viewer to work on SharePoint Document Library

Use case: On a single page, the user needs to fill in the metadata fields for the uploaded PDF document in the document library.  The Edit Properties page is customized with the Power App.

The variable: thisPDFURL is defined OnStart as - "https://mytenant.sharepoint.com/sites/mysitename/" & SharePointIntegration.Selected.'Full Path'

The Document in the PDF Viewer is defined as the variable thisPDFURL

MichaelK2020_0-1596819061849.png

I have seen an example online where an HTTP request type of flow is used to get the permissions required to access the SharePoint Document Library, however, this trigger is PREMIUM.

I'm rather inexperienced with Power Apps.  Can someone demonstrate how I can hook up the PDF Viewer to display the document?  Is there an alternative Flow trigger that isn't PREMIUM?  Can the flow be triggered on form load, so it just opens without user intervention?  How is this done?

This may be a variant of the advice given by community member: @WarrenBelz 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @MichaelK2020 ,

Do you set up a column in your SP List to store the File Name of the files stored in your SP Library?

 

Regarding the needs that you mentioned, I think the solution I provided above could achieve your needs. Actually, you just need to fill the file name (e.g. Sample1.pdf) within the column in your SP List. Then you just need to pass the PDF file name from your canvas app to your flow.

Within your flow, you need to add a "Get file content using path" action to retrieve the file content based on the passed PDF file name. Then add a "Response to a PowerApp to flow" action, specify a "Text" Output, and put the retrieved file content as the value (Binary content), and return back to canvas app.

Note: I assume that all PDF files are stored in same SP Library folder.

 

Please try the solution I provided above step by step, then try it again in your canvas app, check if the issue is solved.

 

Regards,

Community Support Team _ Kris Dai
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

8 REPLIES 8
krishnags
Super User
Super User

@MichaelK2020 since it is an experimental feature - we cannot guarantee it's functionality. Even I come across these scenarios.

 

Instead of 'full path' try 'link to item' property (just to give a shot)

KrishnaV
Super User III
Super User III

Hi @MichaelK2020 ,

 

It requires a Flow to fix the issue see the below thread to fix your issue:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Not-able-to-render-PDF-in-PowerApps-PDF-View...

OR
https://powerusers.microsoft.com/t5/Building-Power-Apps/View-PDF-Files/td-p/31670

Mr. @WarrenBelz helped me on this long back!


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
v-xida-msft
Community Support
Community Support

Hi @MichaelK2020 ,

Do you want to preview PDF file stored in your SP Library using PDF Viewer control?

 

Currently, these files stored in SP Site are required authentication when you access them in canvas app. Regarding the needs that you mentioned (without using PREMIUM connector), I think the combination of Power Automate and Power Apps could achieve your needs.

 

The user Brian Edwards has posted detailed steps on how to preview PDF files stored in SP Library in canvas app, please check the following blog:

https://masteroffice365.com/viewing-pdfs-from-sharepoint-within-powerapps/

https://youtu.be/Clu45Rknpvk

 

Please try above solution, then check if the issue is solved.

 

Regards,

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

Thank you.

@krishnags 

'Link to Item' wasn't even an option here.

Thank you, @KrishnaV .  I got the Power App to call the flow.  It wasn't passing the file path.  Perhaps the value of the variable wasn't defined at the time the App called the flow.  The flow would run continuously until I manually cancelled it.

Thank you @v-xida-msft .

I had already found those online.  My use case differs in that I'm using a customized list form, not a document library gallery.  The full path variable doesn't seem to be defined at the time of the Flow call, so the flow doesn't work properly.  To test that theory, I hard coded a full path value into the Flow call and the flow completed.  The PDF didn't show, so even when the flow didn't fail, the use was unsuccessful.

Hi @MichaelK2020 ,

Do you set up a column in your SP List to store the File Name of the files stored in your SP Library?

 

Regarding the needs that you mentioned, I think the solution I provided above could achieve your needs. Actually, you just need to fill the file name (e.g. Sample1.pdf) within the column in your SP List. Then you just need to pass the PDF file name from your canvas app to your flow.

Within your flow, you need to add a "Get file content using path" action to retrieve the file content based on the passed PDF file name. Then add a "Response to a PowerApp to flow" action, specify a "Text" Output, and put the retrieved file content as the value (Binary content), and return back to canvas app.

Note: I assume that all PDF files are stored in same SP Library folder.

 

Please try the solution I provided above step by step, then try it again in your canvas app, check if the issue is solved.

 

Regards,

Community Support Team _ Kris Dai
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

Good point!

   I try to avoid "preview", "experimental" and other non-production level connectors or features. Many popular blog posts and YouTube videos include these types of connectors not realizing that these features can be taken out at any time, without notice. This happened with a "preview" connector in Flow for Azure and it broke an important production application of ours.

 

   The "PDF viewer" is a practical feature, so hopefully, it can be added to production soon. Even better would be if a pdf within an SPO list can be added without the need of Flow.

 

Steve in Spain

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (58,327)