Get-SPOVersionPolicyWithChanges
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.
Use -Remove with -FileType to delete a per-file-type override.
Examples
Example 1
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
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
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.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
Default
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
FileType
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | 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.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
Default
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
FileType
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | 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.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
FileType
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
FileTypeRemove
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | 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.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
Default
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
FileType
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Remove
Removes the per-file-type override identified by -FileType. -FileType is required when this switch is specified.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
FileTypeRemove
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | 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.
Parameter properties
| Type: | SPOFileVersionPolicySettings |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see 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.