Let’s look at how to create a Microsoft Flow, building on the steps from my initial post about viewing PDFs within PowerApps.
In my previous article, I indicated that Slide 4 is where the magic of this PowerApp happens. Let’s take a closer look at the Microsoft Flow piece of the app.
Since there isn’t a template that will work for this project, I had to create a Flow from scratch.
Before I go any further I need to point out that the key piece of information we will be using from the PDF is the “Identifier.” This is being pulled into the PowerApp through the SharePoint connected database.
Now, onto building the workflow!
Steps to Building a Microsoft Flow
Step 1
Create a new Flow and search for the action called “Request.”
We are starting with a trigger when an HTTP request is received. This means that every time PowerApps tries to load a PDF it sends a request to a URL that is this Flow.
Now we will be using the “GET” method to retrieve the Identifier of the currently selected PDF in the Gallery control.
Also, the HTTP POST URL field is blank until we are finished building the Flow and save it. Then this field will be populated, and we can copy the URL to use within the PowerApp.
Step 2
The next step is to capture the item Identifier from the request. We will be passing the Identifier from the file to the request.
To pull this off we need to use a variable. Search for a variable and select “Variables – Initialize variable.” Name it something descriptive like pdfID, or whatever makes the most sense to you. The type will be a String.
The Value is where we are going to dictate the part of the HTTP request we want to grab the Identifier information from.
To do this, we must write an Expression. This Expression will use specific criteria to search the HTTP request for the information that we need. Without getting too technical on you, here is the Expression that will be saved within the Value field: trigger()[‘outputs’][‘queries’][‘itemid’].
In other words, we are going to pass into the body of the URL an item ID. The Variable will extract it from all of the material that came in with the request.
Step 3
Now we can create a SharePoint action, specifically “SharePoint – Get file content.” Set the Site Address field to the site that your PDF files are stored in.
The next field, File Identifier, is asking for the information that we just stored within the Variable from the previous step. So add the variable to the File Identifier field.

Step 4
In the final step, we are now going to send this file back to PowerApps. Add another “Request” action, but this time it is a “Request – Response.”
In the Body field, we want to add the output of the get file content from the previous step.
If you want your users to have the ability to open up the PDF within a browser window, then we need to configure the Headers fields.
Go ahead and save the Microsoft Flow, making sure to give it a descriptive name.
Scroll up to the first step and you’ll see that the URL field has now been populated. Click on the copy icon, to the right, so that we can paste this URL into the PowerApp.
Integrating the Flow into PowerApps
Back in the PowerApp, click on the PDF viewer control and select the Document property. Paste the URL from the Flow here.
Now we need to tell the control which PDF has been selected from the Gallery control.
At the end of the URL you will need to add “&itemid=” This is the same parameter that we used within the Expression of the Variable from the Flow.
To connect this to the Gallery, add “& Gallery1.Selected.’{Identifier}’”. The name of your Gallery control will need to replace “Gallery1.”
If everything is working properly, you should see the selected PDF from the Gallery in the PDF viewer!
This concludes how I built the Flow and tied it to the PowerApp. In my next article, I will explain how I finished the PowerApp and show you some small details to give your apps a professional look.
Check back next week for more!