Secure Document in Power Automate
Secure Document is a Power Automate action by PDF4me that password protects a Word document and, separately, restricts what an already-open document allows: read-only viewing, comments only, form-field entry only, or tracked revisions only. Use it to distribute confidential contracts with an open password, or to let a review team comment on a document without editing the underlying text.
What this action does
PDF4me Secure Document applies two independent layers of Word security in one call: an open password that gates access to the file at all, and an editing restriction, read-only, comments-only, form-fields-only, or revisions-only, that gates what an already-open document permits. Apply one, the other, or both together, entirely inside a Power Automate flow.
How Do I Authenticate My Power Automate Flow?
To call PDF4me through Power Automate, the flow needs a valid PDF4me API key on the PDF4me Connect connector. Authentication ensures secure communication and validates your identity as an authorized user.
Important Facts You Should Not Miss
Secure On Open / Open Password gate whether the file opens at all. Security Options Protection Type / Protection Password gate what an open document allows. Set either alone, or both for layered security.Security Options Protection Type and Security Options Protection Password are Advanced parameters, not part of the main panel. Expand Advanced parameters to reach them.
Security Options Protection Type and Security Options Protection Password appear under Advanced parameters, separate from the open-password fields above.
Parameters
Required in the action: Operation/docContent and Operation/Document/Name. Open Password becomes required when Secure On Open is Yes. Security Options Protection Password becomes required when Security Options Protection Type is set to anything other than No Protection.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| Operation/docContent | Required | The source Word file's content, mapped from a previous action such as Get file content (SharePoint, OneDrive) or an email attachment. Accepts .docx and .doc. | File Content |
| Operation/Document/Name | Required | The Word file name including its extension. The output file keeps this same name. | document.docx |
| Secure On Open | Optional | Yes requires Open Password to open the file at all. No (default) leaves the file openable without a password. | Yes |
| Open Password | Conditional | The password required to open the document. Required when Secure On Open is Yes. | SecurePass123! |
| Security Options Protection Type (Advanced) | Optional | No Protection (default), Read Only, Allow Comments, Allow Form Fields, or Allow Revisions. Controls what an open document permits. | Read Only |
| Security Options Protection Password (Advanced) | Conditional | The password required to remove the editing restriction. Required when Protection Type is not No Protection. | EditPass456! |
Security Options Protection Type values
No ProtectionRead OnlyAllow CommentsAllow Form FieldsAllow RevisionsHow Do I Set Up Secure Document in Power Automate?
- Add Secure Document to your flow as a new step.
- Sign in to PDF4me Connect with your API key.
- Map Operation/docContent from a previous action and set Operation/Document/Name with the
.docxextension. - To add an open password: set Secure On Open to Yes and provide Open Password.
- To restrict editing: expand Advanced parameters, set Security Options Protection Type, and provide Security Options Protection Password.
- Run the flow, check Success, then route the returned document to SharePoint, OneDrive, or an email attachment.
Output
| Field | Type | Description |
|---|---|---|
| document | Base64 | Word document with the requested security settings applied. |
| Success | Boolean | true if the operation succeeded, false if it failed. |
| ErrorMessage | String | Error description, null when Success is true. |
| Errors | Array | Detailed error entries, empty when Success is true. |
Common Error Messages
| Error message | Cause | Solution |
|---|---|---|
Request is empty | Request object is null | Provide a valid request object |
Document is empty | Document object is null | Provide a valid Word document |
Password is required when SecureOnOpen is enabled | Secure On Open is Yes but no Open Password was provided | Provide Open Password when Secure On Open is Yes |
Protection password is required for document protection | Protection Type is set but no Protection Password was provided | Provide Security Options Protection Password when using an editing restriction |
Error loading document from bytes | Invalid or corrupted Word document | Verify the input document is a valid .docx file |
Typical Setups
- Trigger when a confidential document is ready in SharePoint.
- Set Secure On Open Yes with a generated Open Password.
- Optionally also set Protection Type Read Only.
- Email the secured document and its password through separate channels.
- Trigger when a document enters a review queue.
- Set Secure On Open No (reviewers open freely).
- Set Protection Type Allow Comments with a protection password.
- Send to reviewers; only comments can be added.
- Trigger when a form template is published.
- Set Protection Type Allow Form Fields with a protection password.
- Distribute the form; recipients can only fill in fields.
- Collect completed forms back into the flow.
Practical Tips
Deliver the secured document and its Open Password or Protection Password through separate channels, for example email and Teams, so intercepting one does not expose both.
Security Options Protection Type and Protection Password are collapsed under Advanced parameters by default. If your restriction is not applying, confirm you expanded that section and set both fields.
Add a condition on Success before saving or emailing document. A false Success with a populated ErrorMessage means no valid file was produced.
They protect different layers. Reusing the same password means anyone who can open the file can also strip its editing restriction.
Pull passwords from a secure variable, Key Vault, or a per-recipient generated value rather than a literal string typed into the action, so the same flow does not leak one password across every document it secures.
Cheat Sheet
| Goal | Secure On Open | Protection Type |
|---|---|---|
| Confidential distribution | Yes | No Protection (or Read Only for extra safety) |
| Team review, comments only | No | Allow Comments |
| Fillable form | No | Allow Form Fields |
| Collaborative editing with audit trail | No | Allow Revisions |
| Maximum lockdown | Yes | Read Only |