Showing results for 
Search instead for 
Did you mean: 

PDF Viewer support for PDF documents in Sharepoint Libraries that require authentication

If the point of PowerApps is to promote building of "Enterprise" Apps, then surely you need to have access to Sharepoint Document libraries that only authenticated Users can access.


Currently you can only view PDFs that reside in libraries that allow anonymous access, quite pointless in an Enterprise environment. That makes this feature useless for most of us.


This one feature would really open a whole lot of possibilities in Enterprise scenarios, especially when trying to wean Users off e-mail oriented workflows.

Status: Planned
Advocate V

Wouldn't it be awesome if you could display actual PDF documents stored in #SharePoint in your #PowerApps?


And wouldn't it be even more cool if doing it was super easy 🤗.


Viewing PDFs from SharePoint within your PowerApps

Advocate V

Viewing actual PDF documents stored in SharePoint that only authenticated users have permission to access has actually been possible for some time without any workarounds or hacks for that matter using v2 of the SharePoint REST Graph APIs.


I have posted a video of a demo app I've created demonstrating this technique:


The corresponding blog for this demo will be published imminently... 



Advocate V

It certainly took far longer then I initially anticipated, but I believe this blog should definitely be worth the wait!  The demo video for the corresponding blog speaks for itself really. It goes way beyond simply displaying PDF documents in Sharepoint Libraries that require authentication.
PowerApps & SharePoint – The Ultimate User Experience

Rather than me trying to describe whether this blog is worth reading or not, feel free to leave your comments on this thread about any functionality in particular you may think is pretty awesome 😁

Helper II

@Office365Master  "22m ago" this is very timely as I am just losing my head as no workaround I have found on the web seems to work. so what you are saying is that if I follow your steps I can show a pdf in the viewer control even though it resides in a Sharepoint Document library. I remain hopeful. If not: Microsoft, this has been requested for three years now

Helper II

okay, I don't get it. @Office365Master which of those is the flow to show a PDF? and would it need a premium connector (i.e. response)?

Advocate V


Per the announcement earlier in July 2019, the licensing plans for both PowerApps and Power Automate (aka Flow) have significantly changed as of October 2019.


I cannot speak for exactly how the latest licensing changes affect your own organization, but if certainly for some scenarios I think the blog I published inclusive of the highly reusability of those Flows may if anything reduce your licensing requirements / costs.


As I understand it, the moment anyone in your organization creates a single PowerApp that includes using even just one Flow / Power Automate business process and shares that app inclusive of that Power Automate 'Flow', you'll either need a Power Automate per user plan or a Power Automate per flow plan. 


To quote from:

"For Power Automate, an unlicensed user that signs in to will be setup with the free Power Automate plan. If later they try to perform an action like sharing a flow, they will be prompted to sign up for a trial. In this example, if the user accepted the offer for trial they would be signed up for a Power Automate trial."


The blog I have now published is quite possibly something that was far from desirable from a licensing perspective because of the extent to which the Flows I have shared are reusable. If you opt to choose for the Power Automate per flow plan, for $500 per month anyone in your organization can leverage up to 5 Flows per month, with up to 15k API requests per 24 hours. You can easily drop the PA_Graph_Search_Sites and the PA_Graph_Item_Versions Flows from the 7 Flows I have shared, leaving you with requiring just one Power Automate per flow plan license (per 15k API requests per 24 hours).


That just adds to how awesome the blog I published is for most organizations. 😂

Perfect timing for this blog in fact, because a couple of months ago, you would have been absolutely correct in that any users or App Makers would have required a PowerApp Plan 2 license in order to leverage the flows I've shared. 


Practically speaking though, it is highly probable that some App Makers in organization will likely create apps consuming flows that they will no doubt subsequently share with other users, the consequences of which will be that all users in your organization using apps that consume a shared flow will require a Power Automate per user plan license.


Back to the other half of your question though, being "which of those is the flow to show a PDF?". In essence you would need to use just 2 of the flows to enable you to drill down to the level where the PDF documents in any given Document Library are stored. i.e. per the Logical Architecture

  • 2. PA_Graph_Site_List_Libraries
    This Flow (the most “complex”) returns a list of Subsites, Document Libraries and Lists for any given site (or subsite for that matter).
    • 3. PA_Graph_DriveItems
      This Flows returns the list of files and subfolders within a Document Library or within a specific Folder in a Document Library.


For the PA_Graph_Site_List_Libraries flow you just need to pass in the relative path to the site containing your Document Library. For example:  "teams/demo".

From PowerApps add a Button control to your app and set the OnSelect property on that control to:

ClearCollect( SiteDrivesLists, PA_Graph_Site_List_Libraries.Run( "teams/demo" )

From PowerApps add a Dropdown List to your app and set the Items property to the name of the collection you specified having run that Flow (e.g. SiteDrivesLists).


You will then have sufficient info to run the PA_Graph_DriveItems flow. That flow requires 3 input parameters, the values of which you should input as follows:

1.  GetDriveItems_Uri:     

Quite simply concatenate the value of SiteIdListLibraryId with /root in your app in order to construct the value of this parameter when you instantiate this Flow from your app. For example:,095f032c-ed85-48ad-93ec-8f5f836f1e1e,270246dc-f8e3-4c8f-8d4d-55ad9cb9826a/drives/b!Mcmxe9WTWO6cJoEDamPmR-V2ulUleSiLqEPpqd_jB7mKA7V_I00gRK5LMTPY9c-s/root

2.  GetDriveItems_Uri_1

For this parameter specify the page size (aka threshold) for the number of rows to return back to your app using the following Odata query syntax:


3.  Initializevariable-odatanextLink_Value

Only relevant for large Document Libraries that exceed the page size you specified for a previous flow run. More info on this parameter on this page in my blog. By default you should specify this input parameter to:


From PowerApps add another Button control to your app and set the OnSelect property to:


    DocumentLibraryItems, PA_Graph_DriveItems.Run(
        Concatenate( Dropdown1.Selected.SiteIdListLibraryId, "/root" ),


Add a Gallery control to your app and set the Items property to DocumentLibraryItems

Add a PDF Viewer control to your app and set the Document property on that control to:



For other document types such as Word documents or PowerPoint presentations you can follow the exact same steps and all you need to do to convert those documents into a PDF format instead is set the Document property on a PDF Viewer control to the following value instead:

Substitute( Gallery1.Selected.Thumbnail, "transform/thumbnail", "transform/pdf" )


Considering this feedback, I will update the blog to perhaps show some more specific examples such as these ones.


All that for $500. I'll gladly accept donations 😁.

Helper II

thank you for the detailed reply @Office365Master I shall give this a try.


The funny/ironic(?) point about the licensing is that it would probably be easier to convince someone to spend $20k on IT equipment than to sign up for a $500/yr plan. And being a "citizen developer" in a large company I cannot guarantee that what I'm doing gets used in the end so it's really difficult to get any money. I'm just trying to automate processes that frustrate me but it's hard to quantify this.

We are already paying for a E5 Office License for everybody. So while this is would equate to a couple of cents per user its hard to get it (I do understand that some things need to cost money, but this is the reality in corporations) 


thanks again.

Advocate V


I have previously blogged on how to display PDF documents stored in SharePoint in a PDF Viewer control.

Advocate V



I have created a far simplified demo app that pretty much showcases how awesome and easy it is to leverage this code. I've now also shared a link to download the simplified PowerApp on my related blog post:

PowerApps & SharePoint – The Ultimate User Experience


I have also uploaded a far shorter 2 minute video demo of the simplified app to YouTube so anyone can check it out before deciding whether or not they'd like to test drive it 🤗.

Advocate I

2017 this was planned - and apart from some smart but not really fully viable solutions using Office365masters flow solutions - we still don't have a simple way to use a PowerApp that can just show a pdf in a document library.


We get endless updates of model driven apps that offer nothing but 3 years later a simple solution that uses the powerapps authentication to access a document in a library on a mobile device still alludes us.


We have users with iPads using foxit manually loading copies of SP docs onto iPads as that is the cheapest and only solution for accessing docs and offline sync for shared devices.