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 / View PDF files in Shar...
Power Apps
Unanswered

View PDF files in SharePoint Online list from Power apps PDF viewer

(0) ShareShare
ReportReport
Posted on by 15

Please check my formula for viewing pdf documents from pdf viewer in power apps according to the solution provided on the video https://www.youtube.com/watch?v=vqK29FWbLxU&t=1143s 

 

All the Office files and image files are working fine except the PDF files 

Forumula :

If(

Last(

Split(

Gallery3.Selected.'File name with extension',

"."

)

).Result = "pdf",

"appres://datasources/Testing%20Documetns/table/51f93222-62e2-4a05-a3b0-859e29b94944/rows/0/reference/https:%2F%2Fmsmanaged-na. shared-sharepointonl-ea3cc5bb-5184-49af-8ab5-11fd5538f7b7%2F %25253a%25252f%25252fteamashland.sharepoint.com%25252fsites%25252fntx%25252fcit%25252ftest%2FGetFileContentByPath%3Fpath=%252f"

& EncodeUrl(Gallery3.Selected.'Folder path' & Gallery3.Selected.'File name with extension'),

Substitute(

Gallery3.Selected.Thumbnail.Large,

"/thumbnail",

"/pdf"

)

)

 

The author gave me a suggestion like below but it seems not working for me so can anyone help me on this to finish my project ? Any ideas ?

 

"In the document URL the 32 digit id/number between 'azure-apim.net%2Fapim%2Fsharepointonline%2F' and 'datasets%2Fhttps' changes by user. So I kept a single dummy file at root level and saved its url in Pic column. In PA I am looking up that file using its ID and substituting the 32 digit id/number out and concatenating it within my pdf document url. It seems to work."

Show less

 

 

Categories:
  • Ellis Karim Profile Picture
    12,294 Super User 2026 Season 2 on at

    Did you manage to resolve this issue?

    Ellis

  • Sunilprakash7 Profile Picture
    15 on at

    No. Please let me know if have any solution for it.

  • Ellis Karim Profile Picture
    12,294 Super User 2026 Season 2 on at

    I was able to implement the PDFViewer for a SharePoint List using Power Apps (customised SharePoint form). I was able to preview list item attachments (PDF files) using the PDF viewer:

    ekarim2020_1-1632398351316.png

    ekarim2020_7-1632400370471.png

    ekarim2020_0-1632401036754.png

    The list item attachments are displayed in a Gallery:

    ekarim2020_5-1632399901802.png

    ekarim2020_2-1632399752118.png

    The OnSelect code - when clicking on an item in galAttachments:

     

     

    //Set(varAttachmentURL, varContractsLibraryAttachmentURL & lblID.Text & "/" & ThisItem.Name & "?web=1");
    // does not handle image files! 
    Concurrent(
     Set(
     varShowPDFDoc,
     true
     ),
     lblAttachmentName.Text = ThisItem.Name,
     Set(
     fileExt,
     Last(
     Split(
     ThisItem.Name,
     "."
     )
     ).Result
     )
    );
    
    If (
     fileExt = "pdf",
     // Don't need the code below. Using PDFViewer instead, requires Value.
     Set(
     varAttachmentURL,
     lblSiteAddress & "/" & lblFolderPath & lblID & "/" & ThisItem.Name & "?web=1"
     ),
     // Office Documents
     Set(
     varAttachmentURL,
     //lblSiteAddress & "/" & lblFolderPath & lblID & "/" & ThisItem.Name & "?web=1"
     lblSiteAddress & "/_layouts/15/WopiFrame.aspx?sourcedoc=/sites/ContractsRepo/" & lblFolderPath & lblID & "/" & ThisItem.Name & "&action=view"
     );
     // Not opening link, only want to open PDF docs, in PDF viewer
     //Launch(varAttachmentURL)
    )

     

     

    For the PDFviewer, the Document property is:

     

     

    If(
     fileExt = "pdf",
     galAttachments.Selected.Value
     //SamplePdf
    )

     

     

    What worked for me is to use: galAttachments.Selected.Value

    Unfortunately, I don't get to work with Power Apps very often.

    Hope this helps.

    Ellis

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 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard