I wanted to thank those that posted help on how to view a PDF file within a Powerapp. (See below for credit, where it is due.) Since this is not an entirely intuitive procedure, and has a very confusing bug (my assessment), I wanted to provide a concise "how to" on this one.
Source: Sharepoint attahment (variation for SP Library)
Method: Show on attach, Using MS Flow
Limitations: Example ONLY works to view a single PDF attachment.
My purpose for this specific example is to display a PDF as a "preview" before posting to a sharpoint library. Variations of this method can surely be used to display multiple attachments, or if you wish to view a library file.
Powerapps side (props to @AlanC😞
OnAdd control in Form1 of my app executes the submit of the form:
OnSuccess for Form1 executes the flow command:
Create a PDF control on your app. Update the Document Control:
MS Flow side:
Then, we get into the flow. ***NOTE*** the Attachment Content object has the "bug" i was referring too. Be sure to note that below!
Also note, my use of a Variable (FileID) is becuase of the multiple file nature of the Get Attachments action. Get attachment content MUST NOT be inside an Apply to each. The Set Variable captures this for you, and lets you stay out of it. Thus, this example only works with single attahcments. If you have multiple attachments, you will only view one of them this way. I'm sure with some more creativity, you can do this with multiples.
BE SURE YOU NOTE THIS
You MUST use the expression builder to convert the Get Attachment Content to Base64. The expression DOES NOT SHOW this after you save!!! I call this a bug. This is what it looks like when you build it:
Note what happens after you save it, and reopen it (The expression is different!!!) It only shows the Attachment Content object. But, it is converting despite it now showing the expression. This will NOT WORK unless you add the base64() as above. This will frustrate you to no end if you forget it at a later date!!
I hope this example helps you.
If you are trying to view a SP Library file, the process is similar... however, read the credits below to be sure and apply encodeUriComponent to your Get File action. Another source of utter frustration if you do not do it. Also note!!! This command also DISAPPEARS in your action, like my example above. Regardless, you MUST apply it, save the Flow, and you are good, despite the bug.
@AlanC in the post below (Read ALL of his input for pertinent info):
Solved! Go to Solution.
Thanks for sharing this.
Thanks for sharing this.
Really cool stuff.
I'm having trouble with your link to the original article by @AlanC. Is there some other way to get to it? Looks like a helpful read.
Seems maybe the links changed with the new forum update. I put it there so I could refer to it later if I needed too. If I get some time, i might re-look agian, and fix it. However, the "just" of it is in this thread.
Check out the on demand sessions that are available now!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
Features releasing from October 2020 through March 2021