Document Approvals in SharePoint Online, including PDF Conversion, Watermarking and Securing Files

In one of my previous blog posts, we modified an existing Power Automate Approval template and customized it to meet our requirements.

Power Automate allows you to manage the approval of documents across several services, including SharePoint, Dynamics 365, OneDrive for Business etc. This makes Power Automate an increasingly popular choice for running business processes.

In this post, we’ll keep the theme going and follow best practices to create a robust Document Approval Solution for SharePoint Online.


Before we start building our Approval Solution, let’s review the approval scenario we’ll be following:

  • A User will submit documents that contain sensitive information to a SharePoint Online library and the user will then start the approval process manually.
  • Once the approval process is started, the designated manager will receive an email with the file included as an attachment.
  • If the manager ‘Approves’ the request:
    • The document will be converted to PDF.
    • A watermark will then be added diagonally across, reading ‘Confidential’.
    • The file will then be secured with an ‘Owner password‘ and ‘Restrict Printing and Content Copying‘.
    • The original document will then be deleted from the source library.
    • Once The PDF is created, it will be uploaded to the public Library.
  • If the manager ‘Rejects‘ the request, an email will be sent to the user with the manager’s comments.

Please make sure the following prerequisites are in place:

  1. Muhimbi PDF Converter Services Online full, free or trial subscription(Sign up).
  2. Appropriate privileges to create Flows.
  3. Office 365 Outlook and Office 365 Users account.
  4. Working knowledge of Microsoft Power Automate and SharePoint Online.


Setting up SharePoint Online to run our process.


SharePoint 
SPUA 
private 
T Upload 
Name 
Edit ir grid view 
Sync 
&pcrt to ocel 
Modified 
Create a column 
Learn more about column creation, 
Approval com meni 
Description 
Type 
Multiple lines Of text 
Default value 
inter a default value 
Use alcuL•ted Wue @ 
More options


From a High level our Flow will look like:

Step 1:

For this demo, we will use the ‘For a selected item‘ SharePoint Trigger action. We use this trigger to start the Flow manually from the SharePoint Online user interface.


Step 2:

Add the ‘Get file properties’ SharePoint action and select the ‘Library Name‘ in which you want to Run the document approval process and pass the ‘ID‘ value to the ‘Id‘ field.



Step 3:

Add the ‘Get file content‘ SharePoint action and pass the ‘Identifier‘  (Output of ‘Get file properties‘ action) into the ‘File Identifier



Step 4:

Add the ‘Get manager (V2)‘ action and pass the ‘User Id‘ (Output of the ‘For a Selected File‘ trigger action into the ‘User (UPN)‘.


0


Step 5:

Add the ‘Start and wait for approval’ action and configure it with reference to details below :

  • Approval type‘ – Approve/Reject – First to respond.
  • Title‘ – Approval Request by ‘User Name‘ the output of the ‘For a Selected File‘ Trigger.
  • Assigned To‘ – ‘Mail‘ the output of the ‘Get Manager (V2)‘ action.
  • Attachment Name – 1‘ – ‘fileName‘ the output of the ‘For a Selected File‘ trigger.
  • Attachment Content‘ – ‘File Content‘ the output of the ‘Get file content‘ action.


Note: You can configure the details and other values as per your requirements.


Start a nd wait for an approval 
• Approval 
• Assigned to 
Item link 
Item link description 
Enable notifications 
Enable 
Attychments Name • 
Attachments Content - 
File Content x 
+ Add new item 
Hide advanced options 
Approve/Reject - First to respond 
Requested by 
Mail X 
request 
find the 
Add Jink to the item to 
•escribe the link to the item 
Add the email of the person generating this request 
Yes


Step 6:

Add a ‘Condition‘ and set ‘Outcome‘ (Output of the ‘Start an approval action‘ is equal to ‘Approve‘).



Now if the Condition validates to ‘Yes‘ , we will ‘Convert the document to PDF‘, ‘Secure the PDF‘ with an ‘Owner password‘ and ‘Restrict printing‘ and ‘Content Copying‘, ‘upload the PDF‘ file to SharePoint public folder, ‘Delete the original file‘ and ‘Send an Email‘ to the user that the document is approved and uploaded to the public folder. Now, lets review each step in detail.


Step 7a :

In the ‘If Yes‘ section for the condition add the Muhimbi ‘Convert document’ action.

  • ‘Source file name’:  ‘fileName‘ the output of the ‘For a selected file‘ trigger.
  • ‘Source file content’: ‘File Content‘ the output of the ‘Get File Content’ action.
  • Output format: Select the ‘PDF‘ from the dropdown.


Convert document 
• Source file name 
• Source Content 
• Output format 
Show advanced options v 
File Content x


Step 7b:

Add the Muhimbi ‘Add text watermark‘ action and configure it with reference to details below. The configuration will create a diagonal Watermark on the PDF with text ‘Confidential‘.

  • Source file content‘: Use the ‘Processed File Content’ the output of the Muhimbi ‘Convert to PDF’ action.
  • Watermark Content‘: Add text Confidential (Watermark Text).
  • Font family‘: Arial (Name of font e.g. Arial, Time Roman, Calibri etc.)
  • Font color‘: #000000 ( Color in RRGGBB notation).
  • Text alignment‘: Middle Center.
  • Word Wrap‘: Word.
  • Position‘: Middle Center.
  • Width‘: 200.
  • Height‘: 200.
  • Source file name‘: Use the ‘Base File Name’.pdf the output of the Muhimbi ‘Convert to PDF‘ action.
  • Rotation‘: 45.
  • Opacity‘: 50.


Add text watermark 
• Source file content 
• Watermark content 
• Font f.mity name 
• Font size 
• color 
• Text alignment 
• wrap 
• Position 
Source file name 
X Ccordinate When 
•osition• is 
Y Coordinate (When 
Zsition is set t. 
Processed file x 
72 
Middle Center 
Word 
Middle Center 
a 
file name x . pdf 
X Coordinate of the On ' ,'72 an inch) 
Y Coordinate of the watermark (in 1/72 of an inch) 
so 
Show adv.nced options v


Step 7c:

Add the Muhimbi ‘Secure PDF’ action.

  • ‘Source Filename’ – Add the ‘File Content’ the output of the ‘Get file content’ SharePoint action.
  • ‘Open Password’: An optional password that the user must enter in order to open the document. Please note that any password entered here is displayed in clear text to allow Power Automate action field references to be added.
  • Owner Password‘: An optional password that the user must enter in order to change the PDF restrictions. When specifying any PDF Restrictions, this password must be set. Please note that any password entered here is displayed in clear text to allow Power Automate action references to be added.
  • One or more restrictions to apply to the PDF file, separated by a pipe ‘|’ character . By default it applies all restrictions(Print|HighResolutionPrint|ContentCopy|Annotations|FormFields|ContentAccessibility|DocumentAssembly), but any combination is allowed. Enter the word Nothing to not apply any restrictions. In order to activate these settings you must supply an owner password.


Configure the action with reference to screenshot below:



Step 7d:

Use the ‘Create file’ SharePoint action to write the generated PDF document to the output document library.

  • File name‘: Use the ‘Base File Name’.pdf the output of the Muhimbi ‘Secure document‘ action.
  • File Content‘: ‘Processed file content‘ is the output variable of the ‘Secure document’ action.



Step 7e:

Use the ‘Delete file’ SharePoint action and delete the file from the ‘Approval‘ source library.

  • ‘File Identifier‘: ‘Identifier‘ the output of the ‘Get file content‘ action.


Delete file 
• File 결ㆍ『•:tie 
0


Step 7f:

Add the ‘Send an email (V2)’ action to send an update that to the person who requested the ‘Approval‘.

  • To‘: ‘User email‘  the output of the ‘For a selected file‘ trigger.
  • Subject‘: You can create a dynamic ‘Subject‘.
  • Body‘: You can create your own email body using a dynamic variable.


Send an email W2) 
Sym optic " V 
dæent is uplæded to the


If the Approver Rejects‘ the document, we will send an email that the document has been rejected and update the column with the ‘Response comments‘.


Step 8a:

In the ‘If No‘ section for the condition add the SharePoint ‘Update file properties’ action and update the column in the source ‘Approval‘ library.


Note: ‘Apply to each’ will be added automatically around the ‘Update file properties‘ action as soon as you add the ‘Reponses Comment’ variable as it is of type ‘array’.

  • Id‘: ‘ID‘ the output of the ‘For a selected file‘ trigger.
  • Title‘: ‘Title‘ the output of the ‘Get file content‘ action.
  • Approval comment’: ‘Response Comments‘  the output of the ‘Start and wait for approval‘ action.
Apply to each 
Responses x 
IJpdAte file properties 
• Site 
• Library Name 
Shaw .dv.n:ed options 
Add •n


Step 8b:

Outside the ‘Apply to each‘ loop, add the ‘Send an email (V2)’ action to send an update to the person who requested the ‘Approval‘.

  • To‘: ‘User email‘  the output of the ‘For a selected file‘ trigger.
  • Subject‘: You can create a dynamic ‘Subject‘.
  • Body‘: You can create your own email body using a dynamic variable.
Send ! m 引 丨 2 2


Step 9:

Configure RUN-ONLY User. 

In this blog post we used the ‘For a selected item’ trigger to manually start a Flow on a document. This works similarly to Flows that are automatically triggered when a file is created or changed, with one major exception, which is that by default the person starting this Flow will need to authenticate to all services used by it. Although sometimes this is desirable, in general it is not particularly user friendly, especially for non-technical users.

To keep things easy for the end-users, we use Flow’s ‘run-only users’ facility to preconfigure the account used to authenticate with Muhimbi’s conversion service. Configure this setting using the ‘manage run-only users’ card, just below the ‘Owners’ card, see the screenshot below.






All Done! Navigate back to the original library and select an item. Click on the Flow dropdown and click on the name of the Flow you created. Click on Run Flow, it should trigger your Approval process.



Approval 
%iew 
Мате 
SF..re 
-С: Ер ч Ю Моме 
Сору 
мою Ы ву 
Apptovj , 
НИ


If the Customer Approves the document



Properties of a Secured PDF File


Document Properties 
Description Security Fonts Initial View Custom Advanced 
Document Security 
The documents Security Method restricts what can be done to the document To remove 
security restrictions, set the Security Method to No Security. 
Security Method: Password Secu rity 
Can be Opened by: Acrobat 50 later 
All contents of the document are encrypted and search engines cannot access the documents 
metadata. 
Document Restrictions Summary 
printing: 
Changing the Document: 
Document Assembly. 
Content Copying: 
Content Copying for Accessibility. 
Page Extraction: 
Commenting: 
Filling of form fields: 
Signing: 
Creation Of Template %ges.• 
Help 
Not Allowed 
Not Allowed 
Allowed 
Not Allowed 
Allowed 
Not Allowed 
Allowed 
Allowed 
Allowed 
Allowed 
0K 
Show Details— 
Cancel


If the customer rejects the Approval, the column will be updated in the source Approval library.


i" C•gen v 
Approval 
ΑΙ test 
2elete -α to Reume


Subscribe to this blog for the latest updates about SharePoint Online, Power Automate (Microsoft Flow), Power Apps and document conversion and manipulation using The PDF Converter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s