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.
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
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...
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.
https://youtu.be/vSbwmHfqK3cPowerApps & 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 😁.
@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
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)?
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: https://docs.microsoft.com/en-us/power-platform/admin/wp-license-management
"For Power Automate, an unlicensed user that signs in to flow.microsoft.com 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
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:
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:
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:
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" ), "&$top=500", "false" ))
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 😁.
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)
I have previously blogged on how to display PDF documents stored in SharePoint in a PDF Viewer control.
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 🤗.