-
Notifications
You must be signed in to change notification settings - Fork 199
Add and update cmdlets for file version trimming impact data collection and query. #1157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ruchika-mittal01
merged 13 commits into
MicrosoftDocs:main
from
blarrywangmsft:docs-editor/New-SPOTenantApplyFileVersionP-1777916871
May 7, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
29aae17
Learn Editor: Update New-SPOTenantApplyFileVersionPolicyJob.md
blarrywangmsft 12610e6
Add and update cmdlets for file version trimming impact data collecti…
0b87331
Update text.
49c25ac
Update.
ec07c5e
Add note about retention.
cd4fcc8
Address some issues.
f8cd0a4
Address some issues.
dfee3d1
Address some issues.
4efcd7d
Minor changes to stay consistent with PlatyPS output.
ac54ea9
Add more notes around auto and major version limit.
8df9060
Address comments.
a41c78c
Merge branch 'main' into docs-editor/New-SPOTenantApplyFileVersionP-1…
Ruchika-mittal01 a7bf012
typo fix
Ruchika-mittal01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
...ft.Online.SharePoint.PowerShell/Get-SPOTenantApplyFileVersionPolicyJobImpact.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| --- | ||
| 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: | ||
| --- | ||
|
|
||
| # Get-SPOTenantApplyFileVersionPolicyJobImpact | ||
|
|
||
| ## SYNOPSIS | ||
|
|
||
| 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. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ``` | ||
| Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy <SPOFileVersionPolicySettings> [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## 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 trimmed and how much storage would be freed if a trimming job were run with the given version policy. | ||
|
|
||
| > [!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 | ||
|
|
||
| ### Example 1 | ||
| ```powershell | ||
| $policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 50 | ||
| Get-SPOTenantApplyFileVersionPolicyJobImpact -VersionPolicy $policy | ||
| ``` | ||
|
|
||
| Estimates the impact of a trimming job run with a modified policy that limits to 50 major versions. | ||
|
|
||
| ## 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 | ||
|
|
||
| ## 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) |
61 changes: 61 additions & 0 deletions
61
...repoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOTenantVersionPolicy.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| 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-spotenantversionpolicy | ||
| applicable: SharePoint Online | ||
| title: Get-SPOTenantVersionPolicy | ||
| schema: 2.0.0 | ||
| author: blarrywangmsft | ||
| ms.author: blarrywang | ||
| ms.reviewer: | ||
| --- | ||
|
|
||
| # Get-SPOTenantVersionPolicy | ||
|
|
||
| ## SYNOPSIS | ||
|
|
||
| Returns the current tenant-level file version policy as an `SPOFileVersionPolicySettings` object. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ``` | ||
| Get-SPOTenantVersionPolicy [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## 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. | ||
|
|
||
| ## 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) |
196 changes: 196 additions & 0 deletions
196
...nt-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOVersionPolicyWithChanges.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| --- | ||
| 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: | ||
| --- | ||
|
|
||
| # Get-SPOVersionPolicyWithChanges | ||
|
|
||
| ## SYNOPSIS | ||
|
|
||
| Returns a locally modified copy of a version policy. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ### 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>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
|
|
||
| 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). | ||
|
|
||
| Use `-Remove` with `-FileType` to delete a per-file-type override. | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1 | ||
| ```powershell | ||
| 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 | ||
| ``` | ||
|
|
||
| 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 | ||
| ``` | ||
|
|
||
| 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 | ||
|
|
||
| ### -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 | ||
| Type: Boolean | ||
| Parameter Sets: Default, FileType | ||
| 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. | ||
|
|
||
| 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 | ||
| Type: Int32 | ||
| Parameter Sets: Default, FileType | ||
| 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. 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: FileType, FileTypeRemove | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| 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 | ||
| Type: Int32 | ||
| Parameter Sets: Default, FileType | ||
| 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`. `-FileType` is required when this switch is specified. | ||
|
|
||
| ```yaml | ||
| Type: SwitchParameter | ||
| Parameter Sets: FileTypeRemove | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| 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 | ||
|
|
||
| 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) | ||
|
|
||
| [New-SPOTenantApplyFileVersionPolicyJob](New-SPOTenantApplyFileVersionPolicyJob.md) | ||
|
|
||
| [Get-SPOTenantApplyFileVersionPolicyJobImpact](Get-SPOTenantApplyFileVersionPolicyJobImpact.md) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep all your example scripts as a single line #Closed