Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Test-OfficeDocument

Module
PSWriteOffice
Inputs
System.Object System.String[]
Outputs
OfficeIMO.OfficeValidationReport System.Boolean

Validates native document structure, schema, security, accessibility or compliance without changing the input.

Syntax

Test-OfficeDocument
[-Check <Structure|Schema|Security|Accessibility|Compliance>]
[-Options <Object[]>]
[-Password <SecureString>]
[-Path] <String[]>
[-Quiet]
[-Untrusted]
[<CommonParameters>]
#
Parameter set: Path
Test-OfficeDocument
[-Check <Structure|Schema|Security|Accessibility|Compliance>]
-LiteralPath <String[]>
[-Options <Object[]>]
[-Password <SecureString>]
[-Quiet]
[-Untrusted]
[<CommonParameters>]
#
Parameter set: LiteralPath
Test-OfficeDocument
[-Check <Structure|Schema|Security|Accessibility|Compliance>]
[-Document] <Object>
[-Options <Object[]>]
[-Quiet]
[-Untrusted]
[<CommonParameters>]
#
Parameter set: Document

Description

Unsupported checks are reported as not applicable. NativeReports retains native security, capability and PDF proof evidence. Options accepts typed check settings or hashtables; later values replace the matching settings group.

Examples

Validate workbook structure

Test-OfficeDocument -Path .\Reports\Sales.xlsx

Returns the common report and the native workbook doctor findings.

Check untrusted packages

Test-OfficeDocument -LiteralPath .\Uploads\Proposal.docx -Check Security -Untrusted -Quiet

Returns a Boolean after applying the untrusted package policy.

Parameters

-Check OfficeDocumentCheck[] optional
Checks to perform. Defaults to Structure.
Possible values: Structure, Schema, Security, Accessibility, Compliance
-Options Object[] optional
Native check-specific options or flat hashtables, routed to the selected format through the shared binder. For PDF compliance checks, a flat Profile means the compliance profile; use typed PdfLoadOptions for a separate read profile.
-Password SecureString optionalsets: Path, LiteralPath
Password for a path input. Accepts SecureString or PSCredential; plain strings are transformed with a warning.
-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path
Filesystem paths with wildcard expansion.
-Quiet SwitchParameter optional
Returns IsValid as a Boolean instead of the report.
-Untrusted SwitchParameter optional
Also applies the existing untrusted package-security policy.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal filesystem paths; binds FileInfo.FullName and provider PSPath.
-Document Object requiredposition: 0pipeline: True (ByValue)sets: Document
Caller-owned live native model, including unsaved edits.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.