| external help file | sharepointonline.xml |
|---|---|
| Module Name | Microsoft.Online.SharePoint.PowerShell |
| online version | https://learn.microsoft.com/powershell/module/sharepoint-online/new-spositefileversionbatchdeletejob |
| applicable | SharePoint Online |
| title | New-SPOSiteFileVersionBatchDeleteJob |
| schema | 2.0.0 |
| author | msjennywu |
| ms.author | jennywu |
| ms.reviewer | |
| manager | seanmc |
Queues a job to trim versions for all document libraries in a site collection.
New-SPOSiteFileVersionBatchDeleteJob [-Identity] <SpoSitePipeBind> [-Automatic] [-DeleteBeforeDays <Int32>] [-MajorVersionLimit <Int32>] [-MajorWithMinorVersionsLimit <Int32>] [<CommonParameters>]Queues a job to trim versions for all document libraries in a site collection.
Caution: Versions deleted using this cmdlet will be permanently deleted and cannot be recovered from the recycle bin.
New-SPOSiteFileVersionBatchDeleteJob -Identity https://contoso.sharepoint.com/sites/site1 -DeleteBeforeDays 360Example 1 starts a trim job that will delete all file versions that are over 360 days old in all document libraries in the site collection.
New-SPOSiteFileVersionBatchDeleteJob -Identity https://contoso.sharepoint.com/sites/site1 -AutomaticExample 2 starts a trim job that will delete file versions that expired and set version expiration time for the ones not expired in the site collection based on the backend algorithm.
New-SPOSiteFileVersionBatchDeleteJob -Identity https://contoso.sharepoint.com/sites/site1 -MajorVersionLimit 30 -MajorWithMinorVersionsLimit 10Example 3 starts a trim job that will delete file versions in the site collection based on the version count limits.
Specifies the URL of the site collection.
Type: SpoSitePipeBind
Parameter Sets: (All)
Aliases:
Applicable: SharePoint Online
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseTrim file versions using automatic version history limit algorithm.
Type: SwitchParameter
Parameter Sets: AutomaticTrim
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe minimum age of file versions to trim. In other words, all file versions that are older than this number of days will be deleted.
Type: int
Parameter Sets: DeleteOlderThanDays
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseTrim file version using version count limits. Need to specify MajorWithMinorVersionsLimit as well.
Type: int
Parameter Sets: CountLimits
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseTrim file version using version count limits. Need to specify MajorVersionLimit as well.
Type: int
Parameter Sets: CountLimits
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.