Table of Contents

New-PnPLibraryFileVersionBatchDeleteJob

SYNOPSIS

Starts a file version batch trim job for a document library.

SYNTAX

New-PnPLibraryFileVersionBatchDeleteJob -Identity <ListPipeBind> [-DeleteBeforeDays <int>] [-MajorVersionLimit <int>] [-MajorWithMinorVersionsLimit <int>][Automatic][-Force]

DESCRIPTION

Starts a file version batch trim job for a document library.

EXAMPLES

EXAMPLE 1

New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360

Starts a file version batch trim job that will delete all file versions that are over 360 days old in the document library.

EXAMPLE 2

New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 -Force

Starts a file version batch trim job that will delete all file versions that are over 360 days old in the document library, without prompting the user for confirmation.

EXAMPLE 3

New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -Automatic

Starts a file version batch trim job that will delete file versions that expired and set version expiration time for the ones not expired in the document library based on the backend algorithm.

EXAMPLE 4

New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -MajorVersionLimit 30 -MajorWithMinorVersionsLimit 10

Starts a file version batch trim job that will delete file versions in the document library based on the version count limits.

PARAMETERS

-Identity

The ID, name or Url (Lists/MyList) of the document library to perform the trimming on.

Type: ListPipeBind
Parameter Sets: (All)

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: 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.

Type: int
Parameter Sets: DeleteOlderThanDays

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Automatic

Trim file version using automatic trim.

Type: SwitchParameter
Parameter Sets: AutomaticTrim

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MajorVersionLimit

Trim 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: False

-MajorWithMinorVersionsLimit

Trim 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: False

-Force

When provided, no confirmation prompts will be shown to the user.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Microsoft 365 Patterns and Practices