Commands › SharePoint Online

Get-SPOVersionPolicyWithChanges

SharePoint Online Microsoft.Online.SharePoint.PowerShell Get-*

Returns a locally modified copy of a version policy.

Quick start script

# Get-SPOVersionPolicyWithChanges — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Run and inspect
Get-SPOVersionPolicyWithChanges -FileType <String> -Remove <SwitchParameter> -VersionPolicy <SPOFileVersionPolicySettings> | Format-List

# 3. Export for evidence / drift tracking
Get-SPOVersionPolicyWithChanges | Export-Clixml .\SPOVersionPolicyWithChanges-$(Get-Date -Format yyyyMMdd).xml

Syntax — 3 parameter sets

Default (Default)

Get-SPOVersionPolicyWithChanges -VersionPolicy <SPOFileVersionPolicySettings> [-MajorVersionLimit <Int32>]
 [-ExpireVersionsAfterDays <Int32>] [-EnableAutoExpirationVersionTrim <Boolean>] [<CommonParameters>]

FileType

Get-SPOVersionPolicyWithChanges -VersionPolicy <SPOFileVersionPolicySettings> -FileType <String>
 [-MajorVersionLimit <Int32>] [-ExpireVersionsAfterDays <Int32>]
 [-EnableAutoExpirationVersionTrim <Boolean>] [<CommonParameters>]

FileTypeRemove

Get-SPOVersionPolicyWithChanges -VersionPolicy <SPOFileVersionPolicySettings> -FileType <String> [-Remove]
 [<CommonParameters>]

Parameters (6)

ParameterTypeRequiredWhat it controls
-EnableAutoExpirationVersionTrim Boolean When `$true`, uses automatic expiration, where Microsoft manages the expiration schedule. When `$false`, uses the manual expiration schedule defined by `-MajorVersionLimit` and `-ExpireVersionsAfterDays`.
-ExpireVersionsAfterDays Int32 The number of days after which versions expire. Set to `0` to disable time-based expiration.
-FileType String yes The file type name whose per-file-type override should be created, updated, or removed. Supported values are `"audio"`, `"video"`, and `"outlookspst"`. Omit this parameter to modify the default policy. For more...
-MajorVersionLimit Int32 The maximum number of major versions to retain.
-Remove SwitchParameter yes Removes the per-file-type override identified by `-FileType`. `-FileType` is required when this switch is specified.
-VersionPolicy SPOFileVersionPolicySettings yes The version policy object to modify, typically piped from `Get-SPOTenantVersionPolicy`. The original object is not modified; a new object with the requested changes is returned.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.