Commands › SharePoint Online

New-SPOSiteManageVersionPolicyJob

SharePoint Online Microsoft.Online.SharePoint.PowerShell New-*

Starts a background job to manage file versions and version history limits for all document libraries in the given site. > [!NOTE] > This feature is currently in preview and may not be available in your tenant.

Quick start script

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

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SPOSiteManageVersionPolicyJob
$before | Format-List

# 3. Make the change (dry run first)
New-SPOSiteManageVersionPolicyJob -Identity <SpoSitePipeBind> -TrimUseListPolicy <SwitchParameter> -WhatIf
New-SPOSiteManageVersionPolicyJob -Identity <SpoSitePipeBind> -TrimUseListPolicy <SwitchParameter>

# 4. Verify and diff
$after = Get-SPOSiteManageVersionPolicyJob
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 2 parameter sets

MandatoryTrimOptionalSync

New-SPOSiteManageVersionPolicyJob [-Identity] <SpoSitePipeBind> [-FileTypes <String[]>] [-ExcludeDefaultPolicy]
 [-TrimUseListPolicy] [-SyncListPolicy] [-BypassSiteLock] [-WhatIf] [-Confirm] [<CommonParameters>]

MandatorySync

New-SPOSiteManageVersionPolicyJob [-Identity] <SpoSitePipeBind> [-FileTypes <String[]>] [-ExcludeDefaultPolicy]
 [-SyncListPolicy] [-BypassSiteLock] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-BypassSiteLock SwitchParameter Indicates whether to allow the job to bypass site lock.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-ExcludeDefaultPolicy SwitchParameter Indicates whether to update the default version history limits and/or to trim file versions that don't have an override.
-FileTypes String[] An array of file type names. The supported file type names are: - Audio - OutlookPST - Video
-Identity SpoSitePipeBind yes Specifies the URL of the site collection.
-SyncListPolicy SwitchParameter Indicates whether to update all of the document libraries' version history limits to that of the site. Or if the site is not broken inheritance for version history limits, then it applies the tenant version history limits.
-TrimUseListPolicy SwitchParameter yes Indicates whether to trim existing versions.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.

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