Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

New-OfficeHiddenDataOptions

Module
PSWriteOffice
Inputs
None
Outputs
OfficeIMO.OfficeHiddenDataOptions

Chooses which hidden data Remove-OfficeHiddenData and Optimize-OfficePdf -Sanitize remove.

Syntax

New-OfficeHiddenDataOptions
[-AnonymousAuthor <String>]
[-KeepProvenance <C2pa|External|AiSource>]
[[-Kind] <OfficeHiddenDataKind[]>]
[-TrackedChanges <Keep|AcceptAll|RejectAll>]
[<CommonParameters>]
#
Parameter set: Default

Description

With no parameters the options select the Default categories: document and custom properties, comments, personal identities, speaker notes, the thumbnail, custom XML, image metadata, printer settings, external references, document variables, revision identifiers and active content such as scripts. Tracked changes, hidden content, provenance, attachments and bookmarks change what readers see or what the file discloses, so they are removed only when you name them.

Examples

Also remove Content Credentials and AI labels, and accept tracked changes.

$options = New-OfficeHiddenDataOptions -Kind Default, Provenance -TrackedChanges AcceptAll
Remove-OfficeHiddenData -Path .\Proposal.docx -Options $options

Remove AI-generated labels from a poster but keep its Content Credentials.

$options = New-OfficeHiddenDataOptions -Kind Default, Provenance -KeepProvenance C2pa, External
Remove-OfficeHiddenData -Path .\Poster.pdf -Options $options

Clean everything, including hidden sheets and attachments.

Remove-OfficeHiddenData -Path .\Budget.xlsx -Options (New-OfficeHiddenDataOptions -Kind All)

Parameters

-AnonymousAuthor String optional
Name that replaces authors on comments and revisions that stay in the file. Defaults to Author.
-KeepProvenance String[] optional
Provenance carriers to keep when Provenance is selected: C2pa (Content Credentials), External (links to Content Credentials) or AiSource (AI-generated labels).
Possible values: C2pa, External, AiSource
-Kind OfficeHiddenDataKind[] optionalposition: 0
Categories to remove, combined. Defaults to Default; All selects every category.
Possible values: DocumentProperties, CustomProperties, Comments, TrackedChanges, PersonalIdentities, HiddenContent, SpeakerNotes, Thumbnail, CustomXml, ImageMetadata, PrinterSettings, ExternalReferences, DocumentVariables, RevisionIdentifiers, Provenance, Attachments, ActiveContent, Default, Bookmarks, All
-TrackedChanges OfficeTrackedChangesAction optional
Keep, accept or reject tracked changes. Defaults to Keep, which reports them and leaves them in place.
Possible values: Keep, AcceptAll, RejectAll

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.