In April 2019 Microsoft announced that a Power App form could be used for SharePoint libraries. The feature used to be available only for SharePoint lists.
This feature brings back the many possibilities that we used to have in the old days using SharePoint Designer and Infopath. Things like cascading menus; permission checks; advanced rules etc. Everything you can build in a Power App basically.
Great, you might think, there is a small catch though. For end users to get to the new Power App form in the library they have to take 3 steps:
1. Select the document
2. Click on the 'I'
3. Click on 'Edit all'
As you can imagine this process is quite cumbersome and it's likely that end users will skip filling out the metadata or just use the default SharePoint form (without the checks and gizmos you built into the Power App). Therefore, we would like a possibility to jump right into the Power App form in a single click.
We can easily create a button in each row (for each document) that will open the Power App form using JSON.
Simply create a calculated column in the library with this formula:
And the following code in the Column Formatting:
We use a calculated column to add a column in the library in which we can add the JSON button. You can also use a simple string column for this, but a string column can be seen and edited by end users. Make sure that you add the column to your default view and/or views in which you want the button to appear.
The result will look like this:
Keep in mind that your end users will still have access to the default SharePoint form. If you want to restrict access to some of the columns you should hide them using 'Allow management of content types'.