Skip to main content

Summary

Read the current document protection state including editing restrictions, write protection, and read-only recommendation.
  • Operation ID: protection.get
  • API member path: editor.doc.protection.get(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

Returns a DocumentProtectionState with editingRestriction, writeProtection, and readOnlyRecommended fields.

Input fields

No fields.

Example request

{}

Output fields

FieldTypeRequiredDescription
editingRestrictionobjectyes
editingRestriction.enforcedbooleanyes
editingRestriction.formattingRestrictedbooleanyes
editingRestriction.modeenumyes"none", "readOnly", "comments", "trackedChanges", "forms"
editingRestriction.passwordProtectedbooleanyes
editingRestriction.runtimeEnforcedbooleanyes
readOnlyRecommendedbooleanyes
writeProtectionobjectyes
writeProtection.enabledbooleanyes
writeProtection.passwordProtectedbooleanyes

Example response

{
  "editingRestriction": {
    "enforced": true,
    "formattingRestricted": true,
    "mode": "none",
    "passwordProtected": true,
    "runtimeEnforced": true
  },
  "readOnlyRecommended": true,
  "writeProtection": {
    "enabled": true,
    "passwordProtected": true
  }
}

Pre-apply throws

  • CAPABILITY_UNAVAILABLE

Non-applied failure codes

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {},
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "editingRestriction": {
      "additionalProperties": false,
      "properties": {
        "enforced": {
          "type": "boolean"
        },
        "formattingRestricted": {
          "type": "boolean"
        },
        "mode": {
          "enum": [
            "none",
            "readOnly",
            "comments",
            "trackedChanges",
            "forms"
          ],
          "type": "string"
        },
        "passwordProtected": {
          "type": "boolean"
        },
        "runtimeEnforced": {
          "type": "boolean"
        }
      },
      "required": [
        "mode",
        "enforced",
        "runtimeEnforced",
        "passwordProtected",
        "formattingRestricted"
      ],
      "type": "object"
    },
    "readOnlyRecommended": {
      "type": "boolean"
    },
    "writeProtection": {
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "passwordProtected": {
          "type": "boolean"
        }
      },
      "required": [
        "enabled",
        "passwordProtected"
      ],
      "type": "object"
    }
  },
  "required": [
    "editingRestriction",
    "writeProtection",
    "readOnlyRecommended"
  ],
  "type": "object"
}