In this guide you’ll learn how to secure PDF and Microsoft Office files using a SharePoint Designer Workflow. You can use the SharePoint Designer Workflow Activity to automatically add security settings to documents, including password protection, disabling printing and prevent text copying. This guide can be used in SharePoint Online or On-premises deployments.
Key security features:
- Apply security to MS Word, MS Excel, MS PowerPoint and PDF Files.
- Apply security after user specific watermarks have been applied.
- Apply typical PDF Security including Open Password and Owner Password.
- Prevent Printing, Prevent Text Copy, Prevent Document assembly.
This section covers an example on how to create a MS SharePoint Designer Workflow to automatically apply security settings to any new or modified PDF files in a Document Library. In this example, we use MS SharePoint Designer 2010, but it works just as well in MS SharePoint Designer 2007 as well.
Secure Document Workflow Activity
The following are the options provided by the Secure Document workflow activity:
In typical Muhimbi fashion, the workflow sentence is consistent with our other Workflow Activities, and is largely self-describing.
this document: The document to apply the security settings to. For most workflows selecting Current Item will suffice, but some custom scenarios may require the lookup of a different item. You may also want to check that the file type of the document is ‘pdf’ before trying to apply security.
this file: The name and location of the secured file. Leave this field empty to overwrite the source file with the secured copy. Enter a path, including the Document Library and any folder names, to write the secured file to a separate location. E.g. “shared documents/secured files/confidential.pdf”. You can even specify a different site collection.
open password: When specified, anyone who wants to open the PDF file will need to enter this password.
owner password: When specified, anyone who wants to change the security settings on the PDF file will need to enter this password.
disable options: 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.
Note: In order to activate these settings you must supply an owner password.
List ID: The ID of the list the secured file was written to. This can later be used in the workflow to perform additional tasks on the file such as a check-in or out.
Item ID: The ID of the secured file. Can be used with the List ID.
Before starting, please ensure the following prerequisites are met.
Download and install the Muhimbi PDF Converter for SharePoint.
Make sure you have the appropriate privileges to create workflows on a site collection.
Building the Workflow
You can create the workflow as follows:
Create a new workflow using MS SharePoint Designer.
Associate the workflow with the library of your choice, and tick the boxes next to both ‘Automatically start....’ options and proceed to the next screen.
Because we are running the workflow when PDF files are created as well as modified, a new Yes/No column named Secured will need to be added to the document library using a default value of No. This way we can mark a document as secured and stop the workflows from recursively triggering. Alternatively, if the files are secured in place, you can decide to just trigger the workflow when new files are added.
Design the workflow as per the following screen. In summary it does the following:
Check if the file(s) is / are in PDF format. Otherwise security cannot be applied.
Check if the file(s) has / have already been secured. If it has, then it doesn’t need to be secured again.
The PDF File is secured in place. Both Open and Owner passwords are applied and all restrictions are set.
The file is marked as Secured so the workflow doesn’t repeatedly run.
A status message is written to the workflow history, to record the status of each file.
Publish the workflow and create / convert / upload a new PDF file in the Document Library. After a few seconds the workflow column will change to Completed, indicating that the file has been secured successfully.