- SharePoint document libraries hold original and redacted documents.
- PowerApps provides a friendly user interface to review and select the text to be redacted.
- PowerAutomate calls an Azure function that redacts the selected text and saves it back to SharePoint.
Get the solution
- Download the Power Platform solution from GitHub.
- Update the environment variables to reflect the configuration in your tenant.
- Deploy the Azure function to a resource group.
Easy to use interface with PowerApps
PowerApps makes the process of viewing and selecting text to redact easy for the user:
- A list box on the left is populated with documents from a library.
- The metadata extracted using Microsoft Syntex is displayed on the right.
- Using the PDF Viewer, users can find text in the document to redact. Since there isn’t a method to capture highlighted text in the PDF Viewer, a simple right mouse click and copy allows you to paste it in a text box.
- Clicking the Redact button will send the document and selected text to PowerAutomate where an Azure function is called to redact and return the document.
- The newly redacted document is added to a document library.
Once the document is redacted, PowerApps displays it to the user.
Azure Function Setup
In your Azure subscription you’ll need to create a new resource group (or use an existing one) that will hold the Azure function. This will set up all the necessary components you need, specifically the Endpoint to invoke the service and key to authenticate properly. I created a new resource group on Azure to contain all the components we’ll need.
The URL will be needed in the Power Automate environment parameters as the endpoint for the Azure function.
The core of the solution resides in Power Automate. Activities can be configured to send the document and selected text to be extracted to the Azure function and then add the redacted document back to the document library, all initiated by the Redact button in PowerApps by the user.
Power Automate core activities
Step by step
Let’s break down each activity in Power Automate to understand what’s going on.
Get the file.
The FileContentID variable is passed from PowerApps and represents the ID of the document the user wants to redact information from. We’ll use this later in the process.
Initialize and set a variable representing the phrase to redact. This will be passed from PowerApps representing the text selected by the user.
Using the compose activity in PowerAutomate, it’s critical to convert the content of the file to a base64 binary format. The Azure function needs this format to process the PDF properly.
A few things to consider when calling the Azure function:
- The URI is derived from the Azure function endpoint created in the resource group.
- The selected text that will be redacted in the document needs to have the “redact” name in the body.
Create a new file in SharePoint using the redacted file returned by the Azure Function.
Deploy the Azure function
As part of this solution, I have created an Azure function that will need to be deployed to the resource group created earlier. Download the Visual Studio solution from GitHub and deploy it to a resource group in Azure.