Skip to main content

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.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

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

Open password and editing restriction are independent
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.
Protection Type lives under Advanced parameters
The screenshot confirms Security Options Protection Type and Security Options Protection Password are Advanced parameters, not part of the main panel. Expand Advanced parameters to reach them.
Each password gates its own layer, use different values
Open Password unlocks the file. Protection Password removes the editing restriction on an already-open file. Keep them different so a reviewer who can open the file cannot automatically remove its editing restriction.
Secure Document action in Power Automate showing Operation/docContent and Operation/Document/Name mapped, Secure On Open set to Yes with Open Password abc12, and the Advanced parameters section showing 2 of 2 with Security Options Protection Type set to Read Only and Security Options Protection Password xyz12

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.

ParameterRequiredWhat it doesExample
Operation/docContentRequiredThe 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/NameRequiredThe Word file name including its extension. The output file keeps this same name.document.docx
Secure On OpenOptionalYes requires Open Password to open the file at all. No (default) leaves the file openable without a password.Yes
Open PasswordConditionalThe password required to open the document. Required when Secure On Open is Yes.SecurePass123!
Security Options Protection Type (Advanced)OptionalNo 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)ConditionalThe password required to remove the editing restriction. Required when Protection Type is not No Protection.EditPass456!

Security Options Protection Type values

No Protection
Default. No editing restriction applied.
Read Only
Document can be viewed but not edited.
Allow Comments
Only comments can be added; body text stays locked. Fits review cycles.
Allow Form Fields
Only form fields can be filled in; the rest of the document is locked. Fits fillable templates.
Allow Revisions
Only tracked changes are allowed; direct edits are blocked. Fits collaborative editing with an audit trail.

How Do I Set Up Secure Document in Power Automate?

  1. Add Secure Document to your flow as a new step.
  2. Sign in to PDF4me Connect with your API key.
  3. Map Operation/docContent from a previous action and set Operation/Document/Name with the .docx extension.
  4. To add an open password: set Secure On Open to Yes and provide Open Password.
  5. To restrict editing: expand Advanced parameters, set Security Options Protection Type, and provide Security Options Protection Password.
  6. Run the flow, check Success, then route the returned document to SharePoint, OneDrive, or an email attachment.

Output

FieldTypeDescription
documentBase64Word document with the requested security settings applied.
SuccessBooleantrue if the operation succeeded, false if it failed.
ErrorMessageStringError description, null when Success is true.
ErrorsArrayDetailed error entries, empty when Success is true.

Common Error Messages

Error messageCauseSolution
Request is emptyRequest object is nullProvide a valid request object
Document is emptyDocument object is nullProvide a valid Word document
Password is required when SecureOnOpen is enabledSecure On Open is Yes but no Open Password was providedProvide Open Password when Secure On Open is Yes
Protection password is required for document protectionProtection Type is set but no Protection Password was providedProvide Security Options Protection Password when using an editing restriction
Error loading document from bytesInvalid or corrupted Word documentVerify the input document is a valid .docx file

Typical Setups

Confidential document distribution
  1. Trigger when a confidential document is ready in SharePoint.
  2. Set Secure On Open Yes with a generated Open Password.
  3. Optionally also set Protection Type Read Only.
  4. Email the secured document and its password through separate channels.
Comment-only review cycle
  1. Trigger when a document enters a review queue.
  2. Set Secure On Open No (reviewers open freely).
  3. Set Protection Type Allow Comments with a protection password.
  4. Send to reviewers; only comments can be added.
Fillable form distribution
  1. Trigger when a form template is published.
  2. Set Protection Type Allow Form Fields with a protection password.
  3. Distribute the form; recipients can only fill in fields.
  4. Collect completed forms back into the flow.

Practical Tips

Never send the password in the same message as the file

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.

Remember Advanced parameters for editing restrictions

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.

Check Success before routing the output

Add a condition on Success before saving or emailing document. A false Success with a populated ErrorMessage means no valid file was produced.

Use different values for Open Password and Protection Password

They protect different layers. Reusing the same password means anyone who can open the file can also strip its editing restriction.

Generate passwords, do not hardcode them in the flow

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

GoalSecure On OpenProtection Type
Confidential distributionYesNo Protection (or Read Only for extra safety)
Team review, comments onlyNoAllow Comments
Fillable formNoAllow Form Fields
Collaborative editing with audit trailNoAllow Revisions
Maximum lockdownYesRead Only

Common Questions

What is the difference between Secure On Open and Security Options Protection Type?+
Secure On Open controls whether a password is required just to open the file at all, using the Open Password value. Security Options Protection Type controls what an already-open document allows, for example read-only viewing, comments-only, form-fields-only, or tracked-revisions-only, gated by Security Options Protection Password. See Microsoft's own guidance on protecting a Word document with a password for the underlying Word security model. You can apply either layer alone or both together.
Are Security Options Protection Type and Protection Password Advanced parameters?+
Yes. In the Power Automate connector UI they live under the Advanced parameters section, not the main parameter list. You need to expand Advanced parameters to set an editing restriction; the open-password fields (Secure On Open, Open Password) are in the main panel.
Can I apply an editing restriction without an open password?+
Yes. Leave Secure On Open set to No (or omit it) and only set Security Options Protection Type plus Security Options Protection Password. Anyone can open the file, but they are limited to the chosen restriction, for example Allow Comments, until they enter the protection password to remove it. This underlying protection model is documented on Wikipedia's Microsoft Office password protection page.
What happens if I set Secure On Open to Yes but do not provide Open Password?+
The action returns Success: false with an ErrorMessage similar to "Password is required when SecureOnOpen is enabled". Open Password becomes required the moment Secure On Open is Yes; always validate the flow with both values set together before deploying it.

Same Task on Other Platforms

Get Help