From 29aae1759f2692016f341fa1d8bfd22e7735800f Mon Sep 17 00:00:00 2001 From: blarrywangmsft <129248125+blarrywangmsft@users.noreply.github.com> Date: Mon, 4 May 2026 10:47:53 -0700 Subject: [PATCH 01/12] Learn Editor: Update New-SPOTenantApplyFileVersionPolicyJob.md From 12610e615764b25b6f8c6b0c38283f3b896de610 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Mon, 4 May 2026 11:10:52 -0700 Subject: [PATCH 02/12] Add and update cmdlets for file version trimming impact data collection and query. --- ...POTenantApplyFileVersionPolicyJobImpact.md | 115 +++++++++++ .../Get-SPOTenantVersionPolicy.md | 84 ++++++++ .../Get-SPOVersionPolicyWithChanges.md | 195 ++++++++++++++++++ .../New-SPOTenantApplyFileVersionPolicyJob.md | 61 +++++- 4 files changed, 452 insertions(+), 3 deletions(-) create mode 100644 sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md create mode 100644 sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md create mode 100644 sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md new file mode 100644 index 000000000..05bc65850 --- /dev/null +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -0,0 +1,115 @@ +--- +external help file: Microsoft.Online.SharePoint.PowerShell.dll-Help.xml +Module Name: microsoft.online.sharepoint.powershell +online version: https://learn.microsoft.com/powershell/module/microsoft.online.sharepoint.powershell/get-spotenantapplyfileversionpolicyjobimpact +applicable: SharePoint Online +title: Get-SPOTenantApplyFileVersionPolicyJobImpact +schema: 2.0.0 +author: blarrywangmsft +ms.author: blarrywang +ms.reviewer: +manager: seanmc +--- + +# Get-SPOTenantApplyFileVersionPolicyJobImpact + +## SYNOPSIS + +Estimates how many versions would be trimmed and how much storage would be freed by applying a given version policy to the tenant's collected version dataset. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. + +> [!NOTE] +> This feature is currently in preview and may not be available in your tenant. + +## SYNTAX + +``` +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy [] +``` + +## DESCRIPTION + +Queries the version dataset collected by a previously completed `New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData` job and returns an estimated impact object showing how many versions would be deleted and how much storage would be freed if the specified version policy were applied. + +> [!NOTE] +> - A completed job that was started with `-CollectVersionData` is required before running this cmdlet. Use `Get-SPOTenantApplyFileVersionPolicyJobProgress` to confirm the job has completed. +> - The estimate is based on a snapshot collected during the job and may not reflect changes made to the tenant after the job ran. + +## EXAMPLES + +### Example 1 +```powershell +$policy = Get-SPOTenantVersionPolicy +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy +``` + +Estimates the impact of trimming using the current tenant version policy against the collected dataset. + +### Example 2 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy +``` + +Estimates the impact of a more aggressive policy (50 major versions) compared to the current tenant policy. + +### Example 3 +```powershell +New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData +# Wait for the job to complete, then estimate impact before trimming. +$impact = Get-SPOTenantVersionPolicy | Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $_ +Write-Host "Estimated versions to trim: $($impact.TrimCount)" +Write-Host "Estimated storage freed: $($impact.TrimStorageGB) GB" +``` + +Runs a data-collection job, waits for it to complete, then evaluates the impact of the current policy before committing to a trim operation. + +## PARAMETERS + +### -VersionPolicy +The version policy to evaluate. Use `Get-SPOTenantVersionPolicy` and `Get-SPOVersionPolicyWithChanges` to build this value. + +```yaml +Type: SPOFileVersionPolicySettings +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-ProgressAction`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### None + +## OUTPUTS + +### Microsoft.Online.SharePoint.TenantAdministration.SPOTenantVersionPolicyImpact + +The returned object has the following properties: + +| Property | Type | Description | +|---|---|---| +| TrimCount | Int32 | Estimated number of versions that would be deleted. | +| TrimStorageGB | Double | Estimated storage freed by trimming, in gigabytes. | + +## NOTES + +## RELATED LINKS + +[New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) + +[Get-SPOTenantApplyFileVersionPolicyJobProgress](Get-SPOTenantApplyFileVersionPolicyJobProgress.md) + +[Get-SPOTenantVersionPolicy](Get-SPOTenantVersionPolicy.md) + +[Get-SPOVersionPolicyWithChanges](Get-SPOVersionPolicyWithChanges.md) + +[SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) + +[Microsoft 365 Copilot](/microsoft-365/copilot/microsoft-365-copilot-licensing) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md new file mode 100644 index 000000000..16b5a24be --- /dev/null +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md @@ -0,0 +1,84 @@ +--- +external help file: Microsoft.Online.SharePoint.PowerShell.dll-Help.xml +Module Name: microsoft.online.sharepoint.powershell +online version: https://learn.microsoft.com/powershell/module/microsoft.online.sharepoint.powershell/get-spotenantversiopolicy +applicable: SharePoint Online +title: Get-SPOTenantVersionPolicy +schema: 2.0.0 +author: blarrywangmsft +ms.author: blarrywang +ms.reviewer: +manager: seanmc +--- + +# Get-SPOTenantVersionPolicy + +## SYNOPSIS + +Returns the current tenant-level file version policy as an `SPOFileVersionPolicySettings` object. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. + +> [!NOTE] +> This feature is currently in preview and may not be available in your tenant. + +## SYNTAX + +``` +Get-SPOTenantVersionPolicy [] +``` + +## DESCRIPTION + +Returns the current tenant-level file version policy, including the default policy settings and any per-file-type overrides, as an `SPOFileVersionPolicySettings` object. + +The returned object is a local copy and can be modified using `Get-SPOVersionPolicyWithChanges`. Pass the modified policy to `New-SPOTenantApplyFileVersionPolicyJob` to apply it to the tenant, or to `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate trimming impact without making changes. + +## EXAMPLES + +### Example 1 +```powershell +Get-SPOTenantVersionPolicy +``` + +Returns the current tenant-level file version policy. + +### Example 2 +```powershell +$policy = Get-SPOTenantVersionPolicy +``` + +Stores the current tenant-level file version policy in a variable for further modification with `Get-SPOVersionPolicyWithChanges`. + +### Example 3 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +New-SPOTenantApplyFileVersionPolicyJob -TrimVersions -VersionPolicy $policy +``` + +Retrieves the current policy, changes the major version limit to 100, and starts a job to trim versions using that modified policy. + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-ProgressAction`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### None + +## OUTPUTS + +### Microsoft.Online.SharePoint.TenantAdministration.SPOFileVersionPolicySettings + +## NOTES + +## RELATED LINKS + +[Get-SPOVersionPolicyWithChanges](Get-SPOVersionPolicyWithChanges.md) + +[New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) + +[Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) + +[SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) + +[Microsoft 365 Copilot](/microsoft-365/copilot/microsoft-365-copilot-licensing) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md new file mode 100644 index 000000000..7a93883ad --- /dev/null +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -0,0 +1,195 @@ +--- +external help file: Microsoft.Online.SharePoint.PowerShell.dll-Help.xml +Module Name: microsoft.online.sharepoint.powershell +online version: https://learn.microsoft.com/powershell/module/microsoft.online.sharepoint.powershell/get-spoversionpolicywithchanges +applicable: SharePoint Online +title: Get-SPOVersionPolicyWithChanges +schema: 2.0.0 +author: blarrywangmsft +ms.author: blarrywang +ms.reviewer: +manager: seanmc +--- + +# Get-SPOVersionPolicyWithChanges + +## SYNOPSIS + +Returns a locally modified copy of a version policy without sending any changes to the server. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. + +> [!NOTE] +> This feature is currently in preview and may not be available in your tenant. + +## SYNTAX + +``` +Get-SPOVersionPolicyWithChanges -VersionPolicy [-FileType ] + [-MajorVersionLimit ] [-ExpireVersionsAfterDays ] + [-EnableAutoExpirationVersionTrim ] [-Remove] [] +``` + +## DESCRIPTION + +Returns a modified copy of the given version policy. All changes are local — nothing is sent to the server. This cmdlet is intended to be used in a pipeline with `Get-SPOTenantVersionPolicy` to build a modified policy that can then be passed to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact`. + +When `-FileType` is omitted or set to `"default"`, the default policy settings are modified. When `-FileType` specifies a file type name (for example, `"docx"`), the per-file-type override for that type is created or updated. + +Use `-Remove` with `-FileType` to delete a per-file-type override. The default policy cannot be removed. + +## EXAMPLES + +### Example 1 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +``` + +Retrieves the current tenant version policy and returns a copy with the default major version limit changed to 100. + +### Example 2 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "docx" -MajorVersionLimit 50 -ExpireVersionsAfterDays 180 +``` + +Retrieves the current tenant version policy and returns a copy with a per-file-type override for `docx` files that limits to 50 major versions and expires versions after 180 days. + +### Example 3 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "docx" -Remove +``` + +Retrieves the current tenant version policy and returns a copy with the `docx` file type override removed, so `docx` files will fall back to the default policy. + +### Example 4 +```powershell +$policy = Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 | + Get-SPOVersionPolicyWithChanges -FileType "docx" -MajorVersionLimit 50 +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy +``` + +Builds a modified policy with a 100-version default and a 50-version docx override, then estimates how many versions would be trimmed using the collected dataset. + +## PARAMETERS + +### -EnableAutoExpirationVersionTrim +When `$true`, uses automatic expiration, where Microsoft manages the expiration schedule. When `$false`, uses the manual expiration schedule defined by `-MajorVersionLimit` and `-ExpireVersionsAfterDays`. + +Applies to the default policy or the file type specified by `-FileType`. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExpireVersionsAfterDays +The number of days after which versions expire. Set to `0` to disable time-based expiration. + +Applies to the default policy or the file type specified by `-FileType`. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FileType +The file type name whose per-file-type override should be created, updated, or removed (for example, `"docx"`, `"xlsx"`). Omit this parameter or pass `"default"` to modify the default policy. + +Required when using `-Remove`. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MajorVersionLimit +The maximum number of major versions to retain. + +Applies to the default policy or the file type specified by `-FileType`. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Remove +Removes the per-file-type override identified by `-FileType`. The default policy cannot be removed. `-FileType` is required when this switch is specified. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VersionPolicy +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. + +```yaml +Type: SPOFileVersionPolicySettings +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-ProgressAction`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### Microsoft.Online.SharePoint.TenantAdministration.SPOFileVersionPolicySettings + +## OUTPUTS + +### Microsoft.Online.SharePoint.TenantAdministration.SPOFileVersionPolicySettings + +## NOTES + +## RELATED LINKS + +[Get-SPOTenantVersionPolicy](Get-SPOTenantVersionPolicy.md) + +[New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) + +[Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) + +[SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) + +[Microsoft 365 Copilot](/microsoft-365/copilot/microsoft-365-copilot-licensing) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index 181e44c7a..4c65117cc 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -23,7 +23,8 @@ Queues a job to apply the tenant-level file version policy across all sites. Sha ## SYNTAX ``` -New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-WhatIf] [-Confirm] [] +New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-CollectVersionData] + [-VersionPolicy ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -39,9 +40,10 @@ The following site types are excluded from processing: > [!NOTE] > - Versions deleted using this cmdlet will be permanently deleted and cannot be recovered from the recycle bin. -> - Use `Get-SPOTenant` cmdlet and the `EnableAutoExpirationVersionTrim`, `MajorVersionLimit`, `ExpireVersionsAfterDays` and `VersionPolicyFileTypeOverride` properties to confirm the tenant-level file version policy before running the cmdlet to make sure it matches your intended configuration. +> - Use `Get-SPOTenantVersionPolicy` to confirm the tenant-level file version policy before running the cmdlet to make sure it matches your intended configuration. You can also use the `Get-SPOTenant` cmdlet and check the `EnableAutoExpirationVersionTrim`, `MajorVersionLimit`, `ExpireVersionsAfterDays`, and `VersionPolicyFileTypeOverride` properties. > - If the tenant-level version policy changes while the job is in progress, the job will apply the updated policy to the remaining sites that have not yet been processed. Sites that were already processed will not be re-evaluated or updated. -> - Allow only one job per tenant. +> - Only one job is allowed per tenant. +> - Use `-CollectVersionData` first and wait for the job to complete before running `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a policy without deleting any versions. ## EXAMPLES @@ -66,6 +68,21 @@ New-SPOTenantApplyFileVersionPolicyJob -SetVersionPolicy Example 3 starts a tenant apply file version policy job to set version policy for existing document libraries across all sites. +### Example 4 +```powershell +New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData +``` + +Example 4 starts a job to collect version data across all sites. Once the job completes, use `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a version policy without deleting any versions. + +### Example 5 +```powershell +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +New-SPOTenantApplyFileVersionPolicyJob -TrimVersions -VersionPolicy $policy +``` + +Example 5 retrieves the current tenant version policy, modifies the major version limit to 100 locally, then starts a trim job using that modified policy. The tenant-level policy is updated before the job begins. + ## PARAMETERS ### -Confirm @@ -98,6 +115,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CollectVersionData +Collects version data across all sites for use with `Get-SPOTenantApplyFileVersionPolicyJobImpact`. Use this switch to run a data-collection pass before deciding whether and how to trim versions. The job does not delete any versions when only this switch is specified. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -TrimVersions Trims existing versions for files in document libraries across all sites based on the tenant-level file version policy. @@ -113,6 +145,23 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -VersionPolicy +The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is updated to match this object prior to running the job actions (`-TrimVersions`, `-SetVersionPolicy`, `-CollectVersionData`). + +Use `Get-SPOTenantVersionPolicy` and `Get-SPOVersionPolicyWithChanges` to build this value. + +```yaml +Type: SPOFileVersionPolicySettings +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run. @@ -145,8 +194,14 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar [Get-SPOTenantApplyFileVersionPolicyJobProgress](Get-SPOTenantApplyFileVersionPolicyJobProgress.md) +[Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) + [Remove-SPOTenantApplyFileVersionPolicyJob](Remove-SPOTenantApplyFileVersionPolicyJob.md) +[Get-SPOTenantVersionPolicy](Get-SPOTenantVersionPolicy.md) + +[Get-SPOVersionPolicyWithChanges](Get-SPOVersionPolicyWithChanges.md) + [Get-SPOTenant](Get-SPOTenant.md) [SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) From 0b8733109cedba27fd5700a5d402eee37c791577 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Tue, 5 May 2026 14:32:19 -0700 Subject: [PATCH 03/12] Update text. --- ...POTenantApplyFileVersionPolicyJobImpact.md | 21 +------ .../Get-SPOTenantVersionPolicy.md | 26 +------- .../Get-SPOVersionPolicyWithChanges.md | 63 ++++++++----------- .../New-SPOTenantApplyFileVersionPolicyJob.md | 28 +++++---- 4 files changed, 45 insertions(+), 93 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index 05bc65850..97bbe5928 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -8,7 +8,7 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: seanmc +manager: yigitd --- # Get-SPOTenantApplyFileVersionPolicyJobImpact @@ -38,31 +38,12 @@ Queries the version dataset collected by a previously completed `New-SPOTenantAp ### Example 1 ```powershell -$policy = Get-SPOTenantVersionPolicy -Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy -``` - -Estimates the impact of trimming using the current tenant version policy against the collected dataset. - -### Example 2 -```powershell $policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy ``` Estimates the impact of a more aggressive policy (50 major versions) compared to the current tenant policy. -### Example 3 -```powershell -New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData -# Wait for the job to complete, then estimate impact before trimming. -$impact = Get-SPOTenantVersionPolicy | Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $_ -Write-Host "Estimated versions to trim: $($impact.TrimCount)" -Write-Host "Estimated storage freed: $($impact.TrimStorageGB) GB" -``` - -Runs a data-collection job, waits for it to complete, then evaluates the impact of the current policy before committing to a trim operation. - ## PARAMETERS ### -VersionPolicy diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md index 16b5a24be..ae96cc770 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md @@ -8,17 +8,14 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: seanmc +manager: yigitd --- # Get-SPOTenantVersionPolicy ## SYNOPSIS -Returns the current tenant-level file version policy as an `SPOFileVersionPolicySettings` object. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. - -> [!NOTE] -> This feature is currently in preview and may not be available in your tenant. +Returns the current tenant-level file version policy as an `SPOFileVersionPolicySettings` object. ## SYNTAX @@ -41,21 +38,6 @@ Get-SPOTenantVersionPolicy Returns the current tenant-level file version policy. -### Example 2 -```powershell -$policy = Get-SPOTenantVersionPolicy -``` - -Stores the current tenant-level file version policy in a variable for further modification with `Get-SPOVersionPolicyWithChanges`. - -### Example 3 -```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 -New-SPOTenantApplyFileVersionPolicyJob -TrimVersions -VersionPolicy $policy -``` - -Retrieves the current policy, changes the major version limit to 100, and starts a job to trim versions using that modified policy. - ## PARAMETERS ### CommonParameters @@ -78,7 +60,3 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar [New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) [Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) - -[SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) - -[Microsoft 365 Copilot](/microsoft-365/copilot/microsoft-365-copilot-licensing) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index 7a93883ad..50fb4111a 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -8,33 +8,36 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: seanmc +manager: yigitd --- # Get-SPOVersionPolicyWithChanges ## SYNOPSIS -Returns a locally modified copy of a version policy without sending any changes to the server. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. - -> [!NOTE] -> This feature is currently in preview and may not be available in your tenant. +Returns a locally modified copy of a version policy without sending any changes to the server. ## SYNTAX ``` -Get-SPOVersionPolicyWithChanges -VersionPolicy [-FileType ] +Get-SPOVersionPolicyWithChanges -VersionPolicy [-MajorVersionLimit ] + [-ExpireVersionsAfterDays ] [-EnableAutoExpirationVersionTrim ] [] + +Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType [-MajorVersionLimit ] [-ExpireVersionsAfterDays ] - [-EnableAutoExpirationVersionTrim ] [-Remove] [] + [-EnableAutoExpirationVersionTrim ] [] + +Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType -Remove + [] ``` ## DESCRIPTION Returns a modified copy of the given version policy. All changes are local — nothing is sent to the server. This cmdlet is intended to be used in a pipeline with `Get-SPOTenantVersionPolicy` to build a modified policy that can then be passed to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact`. -When `-FileType` is omitted or set to `"default"`, the default policy settings are modified. When `-FileType` specifies a file type name (for example, `"docx"`), the per-file-type override for that type is created or updated. +When `-FileType` is omitted, the default policy settings are modified. When `-FileType` is specified, the per-file-type override for that type is created or updated. For supported file type names, see [File type version limits in SharePoint](/sharepoint/file-type-version-limits). -Use `-Remove` with `-FileType` to delete a per-file-type override. The default policy cannot be removed. +Use `-Remove` with `-FileType` to delete a per-file-type override. ## EXAMPLES @@ -47,27 +50,17 @@ Retrieves the current tenant version policy and returns a copy with the default ### Example 2 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "docx" -MajorVersionLimit 50 -ExpireVersionsAfterDays 180 +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -MajorVersionLimit 50 -ExpireVersionsAfterDays 180 ``` -Retrieves the current tenant version policy and returns a copy with a per-file-type override for `docx` files that limits to 50 major versions and expires versions after 180 days. +Retrieves the current tenant version policy and returns a copy with a per-file-type override for `video` files that limits to 50 major versions and expires versions after 180 days. ### Example 3 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "docx" -Remove -``` - -Retrieves the current tenant version policy and returns a copy with the `docx` file type override removed, so `docx` files will fall back to the default policy. - -### Example 4 -```powershell -$policy = Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 | - Get-SPOVersionPolicyWithChanges -FileType "docx" -MajorVersionLimit 50 -Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -Remove ``` -Builds a modified policy with a 100-version default and a 50-version docx override, then estimates how many versions would be trimmed using the collected dataset. +Retrieves the current tenant version policy and returns a copy with the `video` file type override removed, so `video` files will fall back to the default policy. ## PARAMETERS @@ -78,7 +71,7 @@ Applies to the default policy or the file type specified by `-FileType`. ```yaml Type: Boolean -Parameter Sets: (All) +Parameter Sets: Default, FileType Aliases: Required: False @@ -95,7 +88,7 @@ Applies to the default policy or the file type specified by `-FileType`. ```yaml Type: Int32 -Parameter Sets: (All) +Parameter Sets: Default, FileType Aliases: Required: False @@ -106,16 +99,14 @@ Accept wildcard characters: False ``` ### -FileType -The file type name whose per-file-type override should be created, updated, or removed (for example, `"docx"`, `"xlsx"`). Omit this parameter or pass `"default"` to modify the default policy. - -Required when using `-Remove`. +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 information, see [File type version limits in SharePoint](/sharepoint/file-type-version-limits). ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: FileType, FileTypeRemove Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -129,7 +120,7 @@ Applies to the default policy or the file type specified by `-FileType`. ```yaml Type: Int32 -Parameter Sets: (All) +Parameter Sets: Default, FileType Aliases: Required: False @@ -140,14 +131,14 @@ Accept wildcard characters: False ``` ### -Remove -Removes the per-file-type override identified by `-FileType`. The default policy cannot be removed. `-FileType` is required when this switch is specified. +Removes the per-file-type override identified by `-FileType`. `-FileType` is required when this switch is specified. ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: FileTypeRemove Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -189,7 +180,3 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar [New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) [Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) - -[SharePoint Advanced Management](/sharepoint/sharepoint-advanced-management-licensing) - -[Microsoft 365 Copilot](/microsoft-365/copilot/microsoft-365-copilot-licensing) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index 4c65117cc..f036ad135 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -23,8 +23,13 @@ Queues a job to apply the tenant-level file version policy across all sites. Sha ## SYNTAX ``` -New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-CollectVersionData] - [-VersionPolicy ] [-WhatIf] [-Confirm] [] +New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-WhatIf] [-Confirm] + [] + +New-SPOTenantApplyFileVersionPolicyJob -VersionPolicy [-TrimVersions] + [-WhatIf] [-Confirm] [] + +New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -43,7 +48,8 @@ The following site types are excluded from processing: > - Use `Get-SPOTenantVersionPolicy` to confirm the tenant-level file version policy before running the cmdlet to make sure it matches your intended configuration. You can also use the `Get-SPOTenant` cmdlet and check the `EnableAutoExpirationVersionTrim`, `MajorVersionLimit`, `ExpireVersionsAfterDays`, and `VersionPolicyFileTypeOverride` properties. > - If the tenant-level version policy changes while the job is in progress, the job will apply the updated policy to the remaining sites that have not yet been processed. Sites that were already processed will not be re-evaluated or updated. > - Only one job is allowed per tenant. -> - Use `-CollectVersionData` first and wait for the job to complete before running `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a policy without deleting any versions. +> - Use `-CollectVersionData` first and wait for the job to complete before running `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a policy without deleting any versions. `-CollectVersionData` cannot be combined with `-VersionPolicy` or `-SetVersionPolicy`. +> - When `-VersionPolicy` is specified, the tenant-level version policy is always updated and `-SetVersionPolicy` is not needed. Optionally add `-TrimVersions` to also trim existing versions. ## EXAMPLES @@ -105,7 +111,7 @@ Sets version policy for existing document libraries across all sites based on th ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: WithExistingVersionPolicy Aliases: Required: False @@ -116,14 +122,14 @@ Accept wildcard characters: False ``` ### -CollectVersionData -Collects version data across all sites for use with `Get-SPOTenantApplyFileVersionPolicyJobImpact`. Use this switch to run a data-collection pass before deciding whether and how to trim versions. The job does not delete any versions when only this switch is specified. +Collects version data across all sites for use with `Get-SPOTenantApplyFileVersionPolicyJobImpact`. Use this switch to run a data-collection pass before deciding whether and how to trim versions. The job does not delete any versions. Cannot be combined with `-VersionPolicy` or `-SetVersionPolicy`. ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: CollectData Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -135,7 +141,7 @@ Trims existing versions for files in document libraries across all sites based o ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: WithExistingVersionPolicy, WithVersionPolicy Aliases: Required: False @@ -146,16 +152,16 @@ Accept wildcard characters: False ``` ### -VersionPolicy -The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is updated to match this object prior to running the job actions (`-TrimVersions`, `-SetVersionPolicy`, `-CollectVersionData`). +The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is always updated and the version policy is propagated to all sites. Optionally combine with `-TrimVersions` to also trim existing versions. Cannot be combined with `-SetVersionPolicy` or `-CollectVersionData`. Use `Get-SPOTenantVersionPolicy` and `Get-SPOVersionPolicyWithChanges` to build this value. ```yaml Type: SPOFileVersionPolicySettings -Parameter Sets: (All) +Parameter Sets: WithVersionPolicy Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False From 49c25ac1d065b807545e680a3d9abeb6da36a430 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Tue, 5 May 2026 14:52:54 -0700 Subject: [PATCH 04/12] Update. --- .../Get-SPOTenantApplyFileVersionPolicyJobImpact.md | 1 - .../Get-SPOTenantVersionPolicy.md | 1 - .../Get-SPOVersionPolicyWithChanges.md | 1 - .../Microsoft.Online.SharePoint.PowerShell.md | 9 +++++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index 97bbe5928..9923913b7 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -8,7 +8,6 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: yigitd --- # Get-SPOTenantApplyFileVersionPolicyJobImpact diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md index ae96cc770..bf02cd2f7 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md @@ -8,7 +8,6 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: yigitd --- # Get-SPOTenantVersionPolicy diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index 50fb4111a..f68037a1a 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -8,7 +8,6 @@ schema: 2.0.0 author: blarrywangmsft ms.author: blarrywang ms.reviewer: -manager: yigitd --- # Get-SPOVersionPolicyWithChanges diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md index 0a54ee0f6..b4b13a467 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md @@ -371,6 +371,9 @@ Get the structural navigation caching state for a web. ### [Get-SPOTenant](Get-SPOTenant.md) Returns SharePoint Online organization properties. +### [Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) +Estimates how many versions would be trimmed and how much storage would be freed by applying a given version policy to the tenant's collected version dataset. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. + ### [Get-SPOTenantApplyFileVersionPolicyJobProgress](Get-SPOTenantApplyFileVersionPolicyJobProgress.md) Gets the status for a tenant apply file version policy job. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. @@ -413,6 +416,9 @@ Returns the current configuration status. ### [Get-SPOTenantTaxonomyReplicationParameters](Get-SPOTenantTaxonomyReplicationParameters.md) Get the replication parameters to manage Multi-Geo taxonomy replication. +### [Get-SPOTenantVersionPolicy](Get-SPOTenantVersionPolicy.md) +Returns the current tenant-level file version policy. + ### [Get-SPOTheme](Get-SPOTheme.md) Returns one or all theme settings from the tenant. @@ -431,6 +437,9 @@ This cmdlet allows SharePoint administrators to check the status of a user or si ### [Get-SPOUserOneDriveLocation](Get-SPOUserOneDriveLocation.md) This cmdlet will return the user principal name, current location, and corresponding OneDrive for Business url, and the site ID. This cmdlet only supports Multi-Geo OneDrive sites. +### [Get-SPOVersionPolicyWithChanges](Get-SPOVersionPolicyWithChanges.md) +Returns a locally modified copy of a version policy without sending any changes to the server. + ### [Get-SPOWebTemplate](Get-SPOWebTemplate.md) Displays all site templates that match the given identity. From ec07c5eb21dab068673519d6a893a77b45e80d8a Mon Sep 17 00:00:00 2001 From: blarrywang Date: Tue, 5 May 2026 15:14:49 -0700 Subject: [PATCH 05/12] Add note about retention. --- .../Get-SPOTenantApplyFileVersionPolicyJobImpact.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index 9923913b7..eaf881505 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -32,6 +32,7 @@ Queries the version dataset collected by a previously completed `New-SPOTenantAp > [!NOTE] > - A completed job that was started with `-CollectVersionData` is required before running this cmdlet. Use `Get-SPOTenantApplyFileVersionPolicyJobProgress` to confirm the job has completed. > - The estimate is based on a snapshot collected during the job and may not reflect changes made to the tenant after the job ran. +> - The estimate does not account for versions protected by retention policies, retention labels, or eDiscovery holds. Actual versions deleted may be fewer than estimated. ## EXAMPLES From cd4fcc8b82d16e82a47b8154663b7ae619e508a2 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 6 May 2026 12:10:39 -0700 Subject: [PATCH 06/12] Address some issues. --- ...POTenantApplyFileVersionPolicyJobImpact.md | 10 ++++---- .../Get-SPOVersionPolicyWithChanges.md | 23 +++++++++++++++---- .../Microsoft.Online.SharePoint.PowerShell.md | 4 ++-- .../New-SPOTenantApplyFileVersionPolicyJob.md | 10 +++++++- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index eaf881505..b4d137a52 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -14,7 +14,7 @@ ms.reviewer: ## SYNOPSIS -Estimates how many versions would be trimmed and how much storage would be freed by applying a given version policy to the tenant's collected version dataset. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. +Estimates how many versions would be trimmed and how much storage would be freed if a trimming job were run with the given version policy. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. > [!NOTE] > This feature is currently in preview and may not be available in your tenant. @@ -27,7 +27,7 @@ Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy [!NOTE] > - A completed job that was started with `-CollectVersionData` is required before running this cmdlet. Use `Get-SPOTenantApplyFileVersionPolicyJobProgress` to confirm the job has completed. @@ -38,8 +38,10 @@ Queries the version dataset collected by a previously completed `New-SPOTenantAp ### Example 1 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 -Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy ( + Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 +) ``` Estimates the impact of a more aggressive policy (50 major versions) compared to the current tenant policy. diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index f68037a1a..e5b3d58f1 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -14,25 +14,32 @@ ms.reviewer: ## SYNOPSIS -Returns a locally modified copy of a version policy without sending any changes to the server. +Returns a locally modified copy of a version policy. ## SYNTAX +### Default (Default) ``` Get-SPOVersionPolicyWithChanges -VersionPolicy [-MajorVersionLimit ] [-ExpireVersionsAfterDays ] [-EnableAutoExpirationVersionTrim ] [] +``` +### FileType +``` Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType [-MajorVersionLimit ] [-ExpireVersionsAfterDays ] [-EnableAutoExpirationVersionTrim ] [] +``` +### FileTypeRemove +``` Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType -Remove [] ``` ## DESCRIPTION -Returns a modified copy of the given version policy. All changes are local — nothing is sent to the server. This cmdlet is intended to be used in a pipeline with `Get-SPOTenantVersionPolicy` to build a modified policy that can then be passed to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact`. +Returns a modified copy of the given version policy. This cmdlet is intended to be used in a pipeline with `Get-SPOTenantVersionPolicy` to build a modified policy that can then be passed to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact`. When `-FileType` is omitted, the default policy settings are modified. When `-FileType` is specified, the per-file-type override for that type is created or updated. For supported file type names, see [File type version limits in SharePoint](/sharepoint/file-type-version-limits). @@ -42,21 +49,27 @@ Use `-Remove` with `-FileType` to delete a per-file-type override. ### Example 1 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 ``` Retrieves the current tenant version policy and returns a copy with the default major version limit changed to 100. ### Example 2 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -MajorVersionLimit 50 -ExpireVersionsAfterDays 180 +Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges ` + -FileType "video" ` + -MajorVersionLimit 50 ` + -ExpireVersionsAfterDays 180 ``` Retrieves the current tenant version policy and returns a copy with a per-file-type override for `video` files that limits to 50 major versions and expires versions after 180 days. ### Example 3 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -Remove +Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -FileType "video" -Remove ``` Retrieves the current tenant version policy and returns a copy with the `video` file type override removed, so `video` files will fall back to the default policy. diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md index b4b13a467..c1e5830ee 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Microsoft.Online.SharePoint.PowerShell.md @@ -372,7 +372,7 @@ Get the structural navigation caching state for a web. Returns SharePoint Online organization properties. ### [Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) -Estimates how many versions would be trimmed and how much storage would be freed by applying a given version policy to the tenant's collected version dataset. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. +Estimates how many versions would be trimmed and how much storage would be freed if a trimming job were run with the given version policy. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. ### [Get-SPOTenantApplyFileVersionPolicyJobProgress](Get-SPOTenantApplyFileVersionPolicyJobProgress.md) Gets the status for a tenant apply file version policy job. SharePoint Advanced Management license or Copilot license is required to run this cmdlet. @@ -438,7 +438,7 @@ This cmdlet allows SharePoint administrators to check the status of a user or si This cmdlet will return the user principal name, current location, and corresponding OneDrive for Business url, and the site ID. This cmdlet only supports Multi-Geo OneDrive sites. ### [Get-SPOVersionPolicyWithChanges](Get-SPOVersionPolicyWithChanges.md) -Returns a locally modified copy of a version policy without sending any changes to the server. +Returns a locally modified copy of a version policy. ### [Get-SPOWebTemplate](Get-SPOWebTemplate.md) Displays all site templates that match the given identity. diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index f036ad135..4fa08af6f 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -22,13 +22,20 @@ Queues a job to apply the tenant-level file version policy across all sites. Sha ## SYNTAX +### WithExistingVersionPolicy (Default) ``` New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-WhatIf] [-Confirm] [] +``` +### WithVersionPolicy +``` New-SPOTenantApplyFileVersionPolicyJob -VersionPolicy [-TrimVersions] [-WhatIf] [-Confirm] [] +``` +### CollectData +``` New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData [-WhatIf] [-Confirm] [] ``` @@ -83,7 +90,8 @@ Example 4 starts a job to collect version data across all sites. Once the job co ### Example 5 ```powershell -$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +$policy = Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 New-SPOTenantApplyFileVersionPolicyJob -TrimVersions -VersionPolicy $policy ``` From f8cd0a4de12a0e8d34fc07ffe615d8c9a7469d30 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 6 May 2026 12:17:55 -0700 Subject: [PATCH 07/12] Address some issues. --- .../Get-SPOTenantApplyFileVersionPolicyJobImpact.md | 7 +++---- .../New-SPOTenantApplyFileVersionPolicyJob.md | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index b4d137a52..cf91f9cb6 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -38,10 +38,9 @@ Queries the version dataset collected by a previously completed `New-SPOTenantAp ### Example 1 ```powershell -Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy ( - Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 -) +$policy = Get-SPOTenantVersionPolicy | + Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 +Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy ``` Estimates the impact of a more aggressive policy (50 major versions) compared to the current tenant policy. diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index 4fa08af6f..29a88d576 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -55,7 +55,7 @@ The following site types are excluded from processing: > - Use `Get-SPOTenantVersionPolicy` to confirm the tenant-level file version policy before running the cmdlet to make sure it matches your intended configuration. You can also use the `Get-SPOTenant` cmdlet and check the `EnableAutoExpirationVersionTrim`, `MajorVersionLimit`, `ExpireVersionsAfterDays`, and `VersionPolicyFileTypeOverride` properties. > - If the tenant-level version policy changes while the job is in progress, the job will apply the updated policy to the remaining sites that have not yet been processed. Sites that were already processed will not be re-evaluated or updated. > - Only one job is allowed per tenant. -> - Use `-CollectVersionData` first and wait for the job to complete before running `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a policy without deleting any versions. `-CollectVersionData` cannot be combined with `-VersionPolicy` or `-SetVersionPolicy`. +> - Use `-CollectVersionData` first and wait for the job to complete before running `Get-SPOTenantApplyFileVersionPolicyJobImpact` to estimate the impact of a policy without deleting any versions. > - When `-VersionPolicy` is specified, the tenant-level version policy is always updated and `-SetVersionPolicy` is not needed. Optionally add `-TrimVersions` to also trim existing versions. ## EXAMPLES @@ -160,7 +160,7 @@ Accept wildcard characters: False ``` ### -VersionPolicy -The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is always updated and the version policy is propagated to all sites. Optionally combine with `-TrimVersions` to also trim existing versions. Cannot be combined with `-SetVersionPolicy` or `-CollectVersionData`. +The new version policy to apply to the tenant before starting the job. When specified, the tenant-level policy is always updated and the version policy is propagated to all sites. Optionally combine with `-TrimVersions` to also trim existing versions. Use `Get-SPOTenantVersionPolicy` and `Get-SPOVersionPolicyWithChanges` to build this value. From dfee3d1ce8ccf194dd34b738b559e8ad2f6e21a7 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 6 May 2026 12:19:02 -0700 Subject: [PATCH 08/12] Address some issues. --- .../Get-SPOTenantApplyFileVersionPolicyJobImpact.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index cf91f9cb6..e0106151a 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -43,7 +43,7 @@ $policy = Get-SPOTenantVersionPolicy | Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy ``` -Estimates the impact of a more aggressive policy (50 major versions) compared to the current tenant policy. +Estimates the impact of a trimming job run with a modified policy that limits to 50 major versions. ## PARAMETERS From 4efcd7d37d03ba129b2c5ee2c8c13141faa2e849 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 6 May 2026 13:04:51 -0700 Subject: [PATCH 09/12] Minor changes to stay consistent with PlatyPS output. --- .../Get-SPOVersionPolicyWithChanges.md | 2 +- .../New-SPOTenantApplyFileVersionPolicyJob.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index e5b3d58f1..d19057a5e 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -33,7 +33,7 @@ Get-SPOVersionPolicyWithChanges -VersionPolicy -F ### FileTypeRemove ``` -Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType -Remove +Get-SPOVersionPolicyWithChanges -VersionPolicy -FileType [-Remove] [] ``` diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index 29a88d576..71f9d85b4 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -30,13 +30,13 @@ New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] [-SetVersionPolicy] [-Wha ### WithVersionPolicy ``` -New-SPOTenantApplyFileVersionPolicyJob -VersionPolicy [-TrimVersions] +New-SPOTenantApplyFileVersionPolicyJob [-TrimVersions] -VersionPolicy [-WhatIf] [-Confirm] [] ``` ### CollectData ``` -New-SPOTenantApplyFileVersionPolicyJob -CollectVersionData [-WhatIf] [-Confirm] [] +New-SPOTenantApplyFileVersionPolicyJob [-CollectVersionData] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION From ac54ea90aa365a5553a79e40d734a267dd57da4f Mon Sep 17 00:00:00 2001 From: blarrywang Date: Wed, 6 May 2026 16:53:05 -0700 Subject: [PATCH 10/12] Add more notes around auto and major version limit. --- .../Get-SPOVersionPolicyWithChanges.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index d19057a5e..f005be46f 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -185,6 +185,13 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar ## NOTES +When `EnableAutoExpirationVersionTrim` is `$true`, `MajorVersionLimit` is always 500 and `ExpireVersionsAfterDays` is always 30. As a result: + +- Switching `-EnableAutoExpirationVersionTrim` from `$false` to `$true` sets `MajorVersionLimit` to 500 and `ExpireVersionsAfterDays` to 30, overriding any values provided for those parameters. +- Specifying `-MajorVersionLimit` or `-ExpireVersionsAfterDays` when the policy has `EnableAutoExpirationVersionTrim` set to `$true` throws an error. + +Always review the returned policy object before passing it to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact` to confirm it reflects the intended configuration. + ## RELATED LINKS [Get-SPOTenantVersionPolicy](Get-SPOTenantVersionPolicy.md) From 8df9060ec9d84a3778608b4f394eab33f68bea61 Mon Sep 17 00:00:00 2001 From: blarrywang Date: Thu, 7 May 2026 09:44:38 -0700 Subject: [PATCH 11/12] Address comments. --- ...POTenantApplyFileVersionPolicyJobImpact.md | 10 +------- .../Get-SPOVersionPolicyWithChanges.md | 23 ++++++++----------- .../New-SPOTenantApplyFileVersionPolicyJob.md | 3 +-- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md index e0106151a..4792ca4ed 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md @@ -38,8 +38,7 @@ Queries the version dataset collected by a previously completed `New-SPOTenantAp ### Example 1 ```powershell -$policy = Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy ``` @@ -73,13 +72,6 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar ### Microsoft.Online.SharePoint.TenantAdministration.SPOTenantVersionPolicyImpact -The returned object has the following properties: - -| Property | Type | Description | -|---|---|---| -| TrimCount | Int32 | Estimated number of versions that would be deleted. | -| TrimStorageGB | Double | Estimated storage freed by trimming, in gigabytes. | - ## NOTES ## RELATED LINKS diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md index f005be46f..3713a5901 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md @@ -49,27 +49,21 @@ Use `-Remove` with `-FileType` to delete a per-file-type override. ### Example 1 ```powershell -Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 ``` Retrieves the current tenant version policy and returns a copy with the default major version limit changed to 100. ### Example 2 ```powershell -Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges ` - -FileType "video" ` - -MajorVersionLimit 50 ` - -ExpireVersionsAfterDays 180 +Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -MajorVersionLimit 50 -ExpireVersionsAfterDays 180 ``` Retrieves the current tenant version policy and returns a copy with a per-file-type override for `video` files that limits to 50 major versions and expires versions after 180 days. ### Example 3 ```powershell -Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -FileType "video" -Remove +Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -FileType "video" -Remove ``` Retrieves the current tenant version policy and returns a copy with the `video` file type override removed, so `video` files will fall back to the default policy. @@ -79,6 +73,8 @@ Retrieves the current tenant version policy and returns a copy with the `video` ### -EnableAutoExpirationVersionTrim When `$true`, uses automatic expiration, where Microsoft manages the expiration schedule. When `$false`, uses the manual expiration schedule defined by `-MajorVersionLimit` and `-ExpireVersionsAfterDays`. +When `EnableAutoExpirationVersionTrim` is `$true`, `MajorVersionLimit` is always 500 and `ExpireVersionsAfterDays` is always 30. As a result, switching `-EnableAutoExpirationVersionTrim` from `$false` to `$true` sets `MajorVersionLimit` to 500 and `ExpireVersionsAfterDays` to 30. + Applies to the default policy or the file type specified by `-FileType`. ```yaml @@ -96,6 +92,8 @@ Accept wildcard characters: False ### -ExpireVersionsAfterDays The number of days after which versions expire. Set to `0` to disable time-based expiration. +Specifying `-ExpireVersionsAfterDays` when the policy has `EnableAutoExpirationVersionTrim` set to `$true` throws an error. + Applies to the default policy or the file type specified by `-FileType`. ```yaml @@ -128,6 +126,8 @@ Accept wildcard characters: False ### -MajorVersionLimit The maximum number of major versions to retain. +Specifying `-ExpireVersionsAfterDays` when the policy has `EnableAutoExpirationVersionTrim` set to `$true` throws an error. + Applies to the default policy or the file type specified by `-FileType`. ```yaml @@ -185,11 +185,6 @@ This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar ## NOTES -When `EnableAutoExpirationVersionTrim` is `$true`, `MajorVersionLimit` is always 500 and `ExpireVersionsAfterDays` is always 30. As a result: - -- Switching `-EnableAutoExpirationVersionTrim` from `$false` to `$true` sets `MajorVersionLimit` to 500 and `ExpireVersionsAfterDays` to 30, overriding any values provided for those parameters. -- Specifying `-MajorVersionLimit` or `-ExpireVersionsAfterDays` when the policy has `EnableAutoExpirationVersionTrim` set to `$true` throws an error. - Always review the returned policy object before passing it to `New-SPOTenantApplyFileVersionPolicyJob` or `Get-SPOTenantApplyFileVersionPolicyJobImpact` to confirm it reflects the intended configuration. ## RELATED LINKS diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md index 71f9d85b4..73c8b30d9 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/New-SPOTenantApplyFileVersionPolicyJob.md @@ -90,8 +90,7 @@ Example 4 starts a job to collect version data across all sites. Once the job co ### Example 5 ```powershell -$policy = Get-SPOTenantVersionPolicy | - Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 +$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100 New-SPOTenantApplyFileVersionPolicyJob -TrimVersions -VersionPolicy $policy ``` From a7bf012b8136bd50624f72089addfe2c3f14f237 Mon Sep 17 00:00:00 2001 From: Ruchika Mittal Date: Thu, 7 May 2026 22:48:40 +0530 Subject: [PATCH 12/12] typo fix --- .../Get-SPOTenantVersionPolicy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md index bf02cd2f7..96bd25f25 100644 --- a/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md +++ b/sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Online.SharePoint.PowerShell.dll-Help.xml Module Name: microsoft.online.sharepoint.powershell -online version: https://learn.microsoft.com/powershell/module/microsoft.online.sharepoint.powershell/get-spotenantversiopolicy +online version: https://learn.microsoft.com/powershell/module/microsoft.online.sharepoint.powershell/get-spotenantversionpolicy applicable: SharePoint Online title: Get-SPOTenantVersionPolicy schema: 2.0.0