PowerApps PDF Viewer SharePoint Document Library without flow
HTML-код
- Опубликовано: 10 июл 2024
- In this Power Apps tutorial video, we will explore how to use the PDF Viewer control in Power Apps to show PDF files & Office documents (Word, PowerPoint, Excel) from SharePoint Document Library without using Power Automate flows. PowerApps PDF Viewer control is using the API to transform Office documents into a PDF file. We can also use the Thumbnail property to show document previews. This entire concept showcases using the PowerApps PDF viewer control without flow.
#PowerApps #PDF #SharePoint
Reference Blogs:
www.cleverworkarounds.com/2018...
www.cleverworkarounds.com/2017...
Table of Contents:
00:00 - Introduction to Power Apps PDF Document Viewer
00:50 - SharePoint Document Library Setup
02:15 - Show Thumbnail of Documents in Power Apps
08:12 - Power Apps PDF Viewer show Word, PowerPoint & Excel documents without flow
15:56 - Show PDF files from SharePoint in PDF Viewer control without flow
24:45 - Subscribe to Reza Dorrani channel
Ok, I figured the multi-user workaround this morning and am sharing my results. Maybe it's worth pinning so it's more easily found. I think a lot of us are wandering around in the dark bumping into stuff because we're not full-time developers and often need very clear stepwise instructions to follow.
If I've messed anything up in these instructions let me know and I'll edit this comment.
So, once you have things working exactly as Reza has so elegantly explained, do the following:
1. Grab a PNG from somewhere.
2. Rename it DONOTREMOVE.png
3. Put it in the lowest/highest level of your document library. You know, the place that exists as soon as you create a new library before you do anything else. NOTE: The file needs to be here to ensure the path only contains the root of the library.
4. Refresh your datasource/library in the app and click on that image in the gallery. Leave the label control in place with Gallery.Selected.Pic as the text so you can see that the appres link is properly generated.
5. Now we're going to change the document property so that it uses a dynamically generated link for that DONOTREMOVE.png file with substitutions for the actual filename and path.
6. Refresh your datasource/library in the app again.
7. Use the Substitute statement from @nikolaus-lukasthomas6288 in the Document property of the PDFViewer.
8. substitute(LookUp(YOURLIBRARYNAME, Name="DONOTREMOVE").Pic, "PowerAppsDocs%252fDONOTREMOVE.png", "")&EncodeUrl(Gallery2.Selected.'Folder path' & Gallery2.Selected.'File name with extension')
Bob's your uncle.
Huge thank you to @RezaDorrani and @nikolaus-lukasthomas6288 for providing me all the answers I needed.
And to reply to my own comment, here is how you remove the need for the DONOTREMOVE image.
1. Put this in the OnSelect of your gallery: Set(appresValue, LookUp(YOURLIBRARYNAME, Name = Gallery2.Selected.Name).Pic)
2. If you still have that debugging label, change it's Text property to appresValue and verify that gallery is setting that varible properly.
3. Use @floscar logic to Split the text in that variable and create a appres link specific to the document chosen. This: First(
Split(
appresValue,"path=%252f")).Value & "path=%252f" & EncodeUrl(
Gallery2.Selected.'Folder path' & Gallery2.Selected.'File name with extension'),
And if you're struggling at all that section belongs inside the larger With statement that comprises the entire Document property for the PDF viewer. Here it is in it's entirety for context.
If(
Last(
Split(
Gallery2.Selected.'File name with extension',//File name with extension',
"."
)
).Value = "pdf",
First(
Split(
appresValue,"path=%252f")).Value & "path=%252f" & EncodeUrl(
Gallery2.Selected.'Folder path' & Gallery2.Selected.'File name with extension'),
Substitute(
Gallery2.Selected.Thumbnail.Large,
"/thumbnail",
"/pdf"
)
)
And what's actually interesting is that all of this is so dynamic that that code above is copied straight out of my app. I didn't have to obfuscate anything at all.
Pinned
Is there a way a video can be made doing this part?
@@user-qg4cx8xi7o I don’t plan to make a follow up video on this
@@RezaDorrani Okay Dokay. Thank you for helpping get it settup. I ended up using a switch case to check for user's name's to know which link is used but hopefully I can figure out the pinned comments way.
First; thank you so much Reza. This is a very clever solution. For all those having issues, I was having issues too. It has been discussed in a few comments.
The problem is, as someone mentioned, that the appres string that is generated includes a unique user code embedded within the string. So while the hard coded appres string will work for the developer all day, it will not work for anyone else, as they will have a different string generated/required for them. SO....the solutions is to grab the appres code dynamically, for each user.
This is what I used.
On-select of the gallery, grab a variable
Then in the Documents property for the PDFviewer split and append string as follows: (replacing the hardcoded appres string)
First(Split(appresValue,"path=%252f")).Value&"path=%252f"&EncodeUrl(gallery.Selected.'Folder path' & gallery.Selected.'File name with extension')
This solved it for me.
Please upvote so people can see the solution. Thanks
You got my vote!
hi there, what do you mean by "grab a variable " how do you write it in on select property ? thanks you
@@gregoirepesenti I had the same question at first. In the gallery's OnSelect prop, set a variable to the text string of the original appres path for the dummy image file in your library. So Set(varAppresValue, LookUp(DocLibrary, Name = "YourImageName").pic). Then split that variable in the PDF viewer Documents prop so it will replace parts of the string with the dynamic values of the selected document instead of the dummy file.
@@ljievsesd thanks for your quick response. I tried this Set(varAppresValue; LookUp(DocsArticles; Nom1 = "1011200.pdf").PDF) but everything turn red in the function (I am using french power apps)
hi@@ljievsesd thanks for your help ! So first, I set my var : Set(VarAppresValue;LookUp('2_Devis_Reparation';Nom = "1676970.png").appresdoc)
then I tried to put it in my appres code. I read somewhere that "the 32 digit id/number between 'azure-apim.net%2Fapim%2Fsharepointonline%2F' and 'datasets%2Fhttps' changes by user" So I tried this :
appres://datasources/2_Devis_Reparation/table/ff23ac89-f437-40cb-811c-82156cc3d7e1/rows/1607/reference/https:%2F%2Feurope-002.azure-apim.net%2Fapim%2Fsharepointonline%"
& varAppresValue // replaces the 32 caracters
& "%2Fdatasets%2Fhttps%25253a%25252f%25252xxxxxxxxxxxxxxxxxxxxxxx%25252fsites%25252fT.SFS-CATALOGUEFI%2FGetFileContentByPath%3Fpath=%252f"
& EncodeUrl(GallerieDevisReparation_2.Selected.'Folder path' & GallerieDevisReparation_2.Selected.'File name with extension')
But it does not works any more. Do you have any other advice ? thanks buddy
Amazing work Reza.. No words to express. I was looking for a similar functionality instead of using Flow and here it as a ready to use.. Clear and precise.. I am really looking forward towards part 2 of this video. Your videos are extremely useful for amateur developers like me.. Great source of knowledge
Thank you. Working on part 2
Must say - it's one of THE BEST !!
Now I can't wait to see part 2 with folders and filters.
Coming soon!
This is probably the most insightful and useful Power Apps video I have watched this year. Genius. Thanks Reza.
🤩 Thank You so much
Absolutely brilliant!! This was a great tutorial and right on time for one of my projects. Please, do continue with the breadcrumbs and the folders! Thank you!!
Thank you. Breadcrumbs and folders is video is here ruclips.net/video/TmRFAP7xTwk/видео.html
This is brilliant, every time I watch your video I learn something new, Thanks very much for your work!!
Thank you. Glad to know that videos are offering something new.
Very cool!
I didn't quite understand the part about having to convert pdf to pdf, but I'll watch it again with more attention.
This apprentice of PowerApps here in Brazil is very grateful for his teachings. 👍
It cost!
Follow the steps for the pdf part again
Mate, you have killed it. Spot on. I was also looking a way to display PDFs without flow. You gave much more. And the next video you talked about, I'm waiting for it. Thanks.
Glad to hear that! Working on the next video.
You’ve cracked what I’ve been trying to work around for the past week. Thank you, sir. Folders and breadcrumbs please!
Glad to hear that.
Folders and breadcrumbs is in the works.
Amazing video! Still 2 years later - ty - qq - which video of yours is corresponding breadcrumbs and folders? @@RezaDorrani ty again!!
@@brucem4508 ruclips.net/video/TmRFAP7xTwk/видео.htmlsi=9UZMU_ma8OLNxD5D
Wow!!!!!!! This is absolutely amazing and mind blowing, well Done Reza!!. Your videos are highly educative, informative and prompt. I am looking forward to the version 2 of this video and many more. Thank you!!!!!!!
Thank you for your kind words. Working on version 2.
Reza, awesome does not even describe your genius. If there was a Power Apps category on America's Got Talent, I would submit your name. I had built a document library using another method I found but after seeing this video, I scrapped it and built it completely over using this solution. Can't thank you enough for the contributions you make to the community.
Wow, thank you!
So happy to hear the solution is useful and many are implementing them in their own use cases.
Can you please tell, how did you use this for documents library?
One word for you Reza "Life Saver", you make Power Apps worthwhile with your videos, please continue with videos its a great source of knowledge millions of developers
Thank you Rahul
Just found this video and relatively new to Power Apps, but this video was absolutely "FANTASTIC" . I also sincerely appreciate your efforts to make it so easy to follow what you have done. You are a fantastic trainer and very articulate! Thank you!
Thank You so much! I have a better version of this video coming out next week.
@@RezaDorrani can u share the link plz
@@EddieSelfene-xi1fh that week was 10 months ago :)
Here is the link ruclips.net/video/JxPznTUsaiQ/видео.htmlsi=cXGjz7gD9j6EAt7J
This video came along at the perfect time for the current project I am working on, thank you so much for producing this!
I did want to share real quick an addition I added to this to allow you to launch a PDF from the viewer, since that control seems to not show up when looking at a PDF doc after implementing your solution. I just added an icon in the same size and position of the pdf viewer pop out icon. I then modified it's visible property to true, only if the document type is PDF. For the on select property I just used Launch('Gallery'.Selected.'Link to item')
That’s a smart add. I did the same in my project. I try to keep videos under 30 mins and some small updates get missed. Thanks for sharing your scenario.
I never normally comment on RUclips vids, but this is brilliant. Thank you Reza!
I appreciate that!
Wow, Reza, my head explodes from pure joy. I had been using Paul Culmsee's flow, but it is a quite complicated ... the solution you show here is mc^2. Thank you!!!!!
Thank You!
Best teacher
Best programmer
Best apps creator
Best applicator
Best of the best
Salute to you
Thank You 🙏
Genius ! Would love to see the next iteration with folders and breadcrumbs :)
Folders and breadcrumbs is in the works.
Folders and breadcrumbs - ruclips.net/video/TmRFAP7xTwk/видео.html
Amazing hack Reza. I have been looking at how to do this without needing flow, This is exactly what I need to finish a project far quicker. Thank you
Glad to hear that! Thanks for watching
As always, Reza, A lifesaver!! Thanks so much! Just love your teaching style!
You are so welcome!
Congrats on this video! I was looking for something without flow and this video helped me a lot. Just an obs in my case: I needed to replace "result" with "value"
Result to Value update was a change made in platform recently
you are genius, omg I need cup of tea to hundel all idea in my head after seeing this video. thanks for sharing
☕️ 👍
Fantastic Reza. Just what I needed to do for my new project. You have done all the heavy-lifting, saving me a lot of time. Thanks a million!
Great to hear!
Any chance you have found a way to play videos stored in the document library without leaving PowerApps?
@@AnandavadivelanV I have not tried that.
@@RezaDorrani hi Reza, have you had any success with adding type MS Stream Video link to the document library and having that play using the Stream player in the PowerApp?
@@AnandavadivelanV I have not given that a try. Something to investigate.
Thanks Reza.. very helpful to see how you displayed the documents without using a Flow.. is interesting that a blog/hack from back in 2017 is still useful today. Folders and breadcrumbs would be an excellent sequel to this video.. keep up the great work..thanks again
Thanks Richard.
Folders and breadcrumbs is in the works.
Great work around, some id been using but helpful on when it was a PDF best way to do it without a Flow. Hopefully Microsoft will implement though at some point a proper “document viewer” with some additional features.
Would love to see you expand this further especially with the folder and breadcrumbs
Folders and breadcrumbs video is in the works. I have that App working and it is 🤩
What a great solution! You really are great, Reza! Thank you very for your discovery!
You are most welcome
Hi @@RezaDorrani. I have been successful with the pdf viewer from this video but lately it is not working until now. Is there a probable change at the backend? The error is: "Couldn't open PDF file Make sure the PDF file is coming from an HTTPS link."
@@SiMataR01 Check pinned comment + ensure your App authoring version is set to a previous recommended version.
You are the best teacher about Power apps, congratulations for your job!!!
Thank You so much!!!
Brilliant video Reza. Too good. Always have wondered how to optimize the pdf viewer control. This is just the next level.
Thanks Joel
Thank you Reza, you helped me a lot with my project.
Glad to hear that
Awsome job! Worth to mention is ,that it is mandatory at 18:54 to change the format to picture otherwise it will just parse the plain url to Powerapps.
However thank you!
Great point! It absolutely is mandatory to do that.
Thank you!
Reza!!! This is a total hack and an answer to soooo many things...Thanks bro. Please please please do not stop. Kindly continue these great educational videos
Thank You. I will keep trying my best to provide unique and valuable content.
Amazing video Reza. So much value! Looking forward to the navigating folder structure add-on.
Thank you.
I am working on the next part.
Please build on the folders and breadcrumbs. This is very informative.. Thanks Reza.
Working on that video
Hi Rezza, I am great admirer of your work and have learnt a lot. Thanks for such great stuff.
I tried this solution, works flawlessly for me but other users are not able to see the documents in PDF viewer even though I have given them "Full Control" over the Sharepoint folder. Anything that you could advise.
Check pinned comment on video
I had created Pdf viewer using flow, but to print that document through the new Print function was not quite right. Instead, I created another Print screen and pdf viewer and tried this method without using Flow. Works perfectly. I wish Powerapps give the option to select the area to print.
Awesome!
Exactly what I have been looking for. It all worked for me
Clean and simple solutions
Thank you very much.
Great to hear!
What can I say??? It is just awesome all the way
Thank You 😊
Hi Reza,
Thank you for all the great ideas and helpful tutorials. I did run into an issue when I created this app and I hope you might have an idea why. The app I created works perfectly for me. However, when I shared with coworker the PDF's don't view. If I make them a co owner and they follow the steps for retrieving the image code and paste in pdf viewer document code, then it works for them but not me, lol. Everything else works but pdf. I was hoping embed this on a SharePoint site for many to use.
Thank you!!!
This was answered by users in comments.
This was the answer from a user “Here is the fix
I think I figured out a solution for my pdf file problem. 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 lookingup that file”
@@RezaDorrani Thank you Reza, you are so fast to respond!!!!
I will give this a try. Keep up the great work. You are famous in my circles. Everyone knows your name :)
@@RezaDorrani Hi Reza, I have the same Problem with the ID Number of diffrent users. I will fix the code but I don't understand what you mean "kept a single dummy file at root level and saved its url in Pic column". What ist the root level and how can i do this? Please can you help me?
I would also like to thank you for your great videos, they have helped me many times!
@@ThomasTreiber-zc1sf Root level means at top level of library not in folders.
@@RezaDorraniok! My Library is Not in a folder it is in the Root of My teamwebsite This is My Top Level. Habe you any idea? It is very Important for me many thanks
Great video again.Clever workaround 😇Thanks Reza.
I was about to bring out launch browser option not showing for the pdf file. But that has been already clarified in the previous comments 👍
Our entire project team following your videos and implementing it😀
Thank you. Happy to hear many are using these concepts in their own projects.
Dear Reza, I am really impressed, you are the MASTER !!!! Thanks a lot for sharing, this tip will solve a strong issue I had since years not been able to see the drawings in *.pdf or *.tif in sharepoint and powerapp. This Thumbnail features is amazing and allowing to see whatever doc as an image.
Thanks so much for your kind words!
I'm no Master. I like exploring, learning new things and sharing them.
Another great tutorial Reza, oh, I have the absolute please to know Paul (he's amazing). I've learnt so much from people like you, Paul and Shane Young.
Thank you Ryan
Thanks Reza Dorrani. Brilliant research and simple to follow instructions.
You are most welcome!
Amazing Reza! I've been following you for a while and every time I think I know enough you surprise me with these brilliant ideas and examples! I'll most definitely use this one! Excellent video. Now I share my challenge with you... I'm trying to do the same for SharePoint list items when you need to preview the attachments! It's taking a lot of reading, but eventually I hope I'll get there. Thanks for sharing!
Thanks for following my work. I always try to do different things and show simple patterns to build apps and flows.
For the list item attachments part, I kind of showed a glimpse of it here ruclips.net/video/EACk5jlQ_jU/видео.html
@@RezaDorrani Thank you again!
Awesome work. You always seem to bring out a vid that suits a couple of use cases I have at any time.... Would definitely like to see folder navigation
Thanks! Will do!
What a great video Reza!!!!! Keep them coming!!!
Thank you. Will keep trying my best.
Great solution, just what I needed I spent a lot of time on a solution for viewing PDF.
Thanks
Glad it was useful
Wow, Thanks a lot! it was first PowerApp and it worked because of your instructions!
Glad to hear that!
Thank you, Reza. Beautiful approach. Felt so very happy. Thank you.
You are most welcome
Really really nice Reza!!! Loved your demo!
Thank You 😊
This is simply awesome. I searched to have to option for last few days and ended up with a not clear viewable excel thumbnail
Thanks for watching.
Hi Reza, once again a great solution. Than you for this,I recognized just now! This brings so much additional options in building user friendly apps.
You are most welcome! The technique showcased in video is something I was trying to crack for months.
This was so extremely helpful! Thank you so much for posting this video. I have subscribed so that if/when you add a video with the extra tid bits you mentioned I can soak up the knowledge!
Thanks for the sub and the part 2 video will be out next week
You always impress me with your works. This video is a must-keep. I might use this in the future. Thanks for sharing your knowledge.
Thank you 😊
Wow 👏🏻 im using that flow approach in one of my app now will be change with this one thanku for this superb trick👍🏻
Go for it!
Woaw Amazing job Reza ! Just what i needed... :D
Thanks
Wao! you are grate Mr. Reza it rocks, I was struck for getting this done without flow, now zuuuuuuup... Thanks a lot for this video.
You are very welcome
Definitely deserve a like. Simply awesome.!!!
Thank you
i was looking for this 4hours ! tankiuuuuuuuuuuuuuuuuuuuuuuuuuu !!!
You are most welcome
Yes, folders, filters and breadcrumbs would be awesome.
Part 2 Video will be out today
Simply awesome informative video eagerly waiting for the next part .Like your all other video tutorials series you are making us more skillful.
Thank you
Thanks a ton! Working on the next one.
Reza Thanks for your video i was stuck on that part on my work it was very useful, it's a relief to get this part done
Glad it helped
Brilliant!! Please continue adding features.
Thank you. Working on it!
You are a genius Reza!!
This works amazingly well. Cannot thank you enough for making this video. 🙂
You're welcome!
@@RezaDorrani When trying to pass a PDF file for the PDF viewer (from a SharePoint DocLib), I am getting a "Couldn't open the PDF File -> Click here to open in your browser" error. Clicking the link to open in my Browser works perfect, but if you have any insight as to why the PDF viewer won't open the file, I would really appreciate a bit more if your genius solutions. From what I've read, it may be related to server authentication, but it's odd to me it opens fine in Chrome when I click the link. Thanks in any case. I love the transform solution for Office files. This is 90% of the files we use.
@@TheShadels Not sure about this issue. I will recommend to post this issue on forums powerusers.microsoft.com
Thank you for sharing your Knowledge Reza! much appreciation 🙏🙏🙏
Thank you for watching
A+, great findings. Waiting for pt2
Thank You
Thank you for this. This video showed me how to do everything I needed to do.
Great 👍
Truly, you are the best. Please do a video to further expand this as you mentioned at the end of this video.
Its already done :)
Here it is ruclips.net/video/TmRFAP7xTwk/видео.html
Really nice job, and I reallly the way you explain your work ! Bravo !
Thank you very much!
Superb!! You played with it...Yes, need that filtering files/folders option.
Folders and breadcrumbs video is here ruclips.net/video/TmRFAP7xTwk/видео.html
Reza, the detective!! Genius.
Thanks 😊
Another awesome video Reza!!
Glad you enjoyed!
Just amazing as always.Thanks, Reza
Thanks 😊
Wow. Another great video from the Power Platform Problem Solver.
More interested on the Specific Folders & Permissions to be displayed on the PowerApp. Consider each list item is tied up with a folder.
Folders and navigation of documents coming soon.
Folder permissions is already covered here ruclips.net/video/QoNQjvHk6qc/видео.html
@@RezaDorrani Thanks Reza. You are the best.
Asombroso truco, gracias por los detalles paso a paso y la explicacion de como resolver estos problemas que a muchos nos cuesta trabajo identificar por que vamos empezando con powerapps
Gracias
Super Super Brilliant.. Thank You Reza for sharing with us.
You are most welcome
many thanks M.Reza Dorrani , you are the best :)
Always welcome
Thank you Reza. Your video gives me more ideas how to improve my apps.
Glad to hear that! Thank you for watching
This is so flippin cool! Thank you so much! This is going to take my new app to the next level.
Glad to hear that. Thanks for watching.
Awesome video. Thank you for the hard work to create valuable content. Please make this into series of videos. Looking forward to it.
Working on part 2
Magic! Brilliant video Reza
Thanks 😊
You are the best teacher! Thats the comment :-)
Thank you! 😃
Excellent material, Reza!!
Most welcome
Hi Reza,
you are the Best! I am much into your Videos an learned a bunch of tricks to handle power apps. Please go on creating! They are all excellent. Greetings
Ralf
Thank You Ralf. I will keep trying my best to create videos and cover new topics.
Brilliant as always... thanks a lot! You are the best!
Thank You
Superb one .....! Once again proven Genius!
Thank you so much 😀
Again thank you for sharing your knowledge, I have made my first power app with user security role case, deep linking, multiple forms and patch data back to backend thanks to all your free video tutorials, just going through all your video collection if you have made any video tutorial how to populate word template and save the file in SharePoint Document folder as new file.
Fantastic! Thanks for watching and liking the videos.
Populating a word document template video is in my backlog (yet to make a video on it).
@@RezaDorrani Wow... Will patiently wait for the release of this video tutorial 😁😁😁 Keep sharing..
Well done Reza, very neat solution!
Thank you
PDF viewer on steroids 💪! Great findings Reza! 👍
Thank You
Thank you Reza, its a great video, great work!!!!!
Thank you 😊
Thank you for this video. Was looking for something like this one. 😊
Thanks for watching
Amazing! Thank you so much for this Raza.
Thanks for watching
So good Reza, thanks again for your awesome videos.
Glad you like them!
Very good video Reza, most informative and will prove really useful in supporting construction on my current project.. Thanks
Great 👍
What a genius, omg bro, you made a break thru.
I was trying this out for months. It surely is a big find.
This is awesome, thanks again for your videos 👍👍👍
Glad you like them!
Absolutely amazing! I love this.
Glad you like it!
Awesome just as I need, it come in time :) for the folder too in the other video
Great 👍
Good news! PDF Viewer now fixed in the latest app authoring version 3.21085.24. Thank you Reza and Microsoft!
Its the Microsoft Team. Glad they fixed it!
Outstanding work!
Thank you! Cheers!