New-SPOListFileVersionBatchDeleteJob
Queues a job to trim versions from a document library.
Syntax
AutomaticTrim
New-SPOListFileVersionBatchDeleteJob
[-Site] <SpoSitePipeBind>
-List <SPOListPipeBind>
[-Automatic]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DeleteOlderThanDays
New-SPOListFileVersionBatchDeleteJob
[-Site] <SpoSitePipeBind>
-List <SPOListPipeBind>
[-DeleteBeforeDays <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CountLimits
New-SPOListFileVersionBatchDeleteJob
[-Site] <SpoSitePipeBind>
-List <SPOListPipeBind>
-MajorVersionLimit <Int32>
-MajorWithMinorVersionsLimit <Int32>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPolicy
New-SPOListFileVersionBatchDeleteJob
[-Site] <SpoSitePipeBind>
-List <SPOListPipeBind>
[-FileTypes <String[]>]
[-ExcludeDefaultPolicy]
[-TrimUseListPolicy]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Queues a job to trim versions from a document library.
Caution: Versions trimmed using this command will be permanently deleted and cannot be recovered from the recycle bin.
Examples
EXAMPLE 1
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -DeleteBeforeDays 360
Example 1 starts a trim job that will delete all file versions that are over 360 days old in the document library called "Documents".
EXAMPLE 2
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Automatic
Example 2 starts a trim job that will delete file versions that expired and set version expiration time for the ones not expired in the document library called "Documents" based on the automatic backend algorithm.
EXAMPLE 3
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -MajorVersionLimit 30 -MajorWithMinorVersionsLimit 10
Example 3 starts a trim job that will delete file versions in the document library called "Documents" based on the version count limits.
EXAMPLE 4
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -TrimUseListPolicy
Example 4 starts a trim job that will delete file versions in the document library called "Documents" based on the version history limits of the document library.
EXAMPLE 5
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -TrimUseListPolicy -FileTypes @("Video", "Audio")
Example 5 starts a trim job that will delete file versions for video and audio file types, and file versions that do not belong to a file type override in the document library based on the version history limits of the document library.
EXAMPLE 6
New-SPOListFileVersionBatchDeleteJob -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -TrimUseListPolicy -FileTypes @("Video", "Audio") -ExcludeDefaultPolicy
Example 6 starts a trim job that will delete file versions for video and audio file types in the document library based on the version history limits of the document library.
Parameters
-Automatic
Trim file versions using automatic version history limit algorithm.
Parameter properties
Type: | System.Management.Automation.SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
AutomaticTrim
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | System.Management.Automation.SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DeleteBeforeDays
The minimum age of file versions to trim. In other words, all file versions that are older than this number of days will be deleted.
Parameter properties
Type: | System.Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
DeleteOlderThanDays
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ExcludeDefaultPolicy
Indicates whether to trim versions based on the default version history limits.
Note
This feature is currently in preview and may not be available in your tenant.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByPolicy
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-FileTypes
An array of file type names to trim versions. The supported file type names are:
- Audio
- OutlookPST
- Video
Note
This feature is currently in preview and may not be available in your tenant.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByPolicy
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-List
The document library name or Id.
Parameter properties
Type: | Microsoft.Online.SharePoint.PowerShell.SPOListPipeBind |
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 |
-MajorVersionLimit
Trim file version using version count limits. Need to specify MajorWithMinorVersionsLimit
as well.
Parameter properties
Type: | System.Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
CountLimits
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-MajorWithMinorVersionsLimit
Trim file version using version count limits. Need to specify MajorVersionLimit
as well.
Parameter properties
Type: | System.Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
CountLimits
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Site
Applicable: SharePoint Online
Specifies the URL of the site.
Parameter properties
Type: | Microsoft.Online.SharePoint.PowerShell.SpoSitePipeBind |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 0 |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-TrimUseListPolicy
Indicates whether to trim versions by applying the document library's version history limits.
Note
This feature is currently in preview and may not be available in your tenant.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByPolicy
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: | System.Management.Automation.SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
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.