Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Current nightly]

### Added
- Added `Get-PnPListVersionPolicy` and `Set-PnPListVersionPolicy` cmdlets to inspect and manage SharePoint Online document library version policies. [#5299](https://github.com/pnp/powershell/pull/5299)
- Added `Get-PnPListVersionPolicy` and `Set-PnPListVersionPolicy` cmdlets to inspect and manage SharePoint Online document library version policies. [#5300](https://github.com/pnp/powershell/pull/5300)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changelog line now attributes the existing Get-PnPListVersionPolicy/Set-PnPListVersionPolicy cmdlets to PR #5300, but this PR’s diff doesn’t include changes for those cmdlets. Please avoid re-pointing existing changelog entries to an unrelated PR; instead, keep the original PR reference and add only new entries relevant to this PR.

Copilot uses AI. Check for mistakes.
- Added `New-PnPSiteManageVersionPolicyJob` cmdlet to queue site-level list version policy trim and sync jobs. [#5300](https://github.com/pnp/powershell/pull/5300)
- Added site version policy parameters to `Set-PnPSite` and `Set-PnPTenantSite`, including support for inheriting tenant defaults, targeting new or existing document libraries, managing file type overrides, and bypassing confirmation with `-Force`. [#5300](https://github.com/pnp/powershell/pull/5300)
- Added `DisableClassicPageBaselineSecurityMode`, `DisableSiteBranding`, `AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled`, `IsAuthoritative`, and `RestrictedContentDiscoveryForCopilotAndAgents` parameters to `Set-PnPSite` and `Set-PnPTenantSite`. [#5300](https://github.com/pnp/powershell/pull/5300)
- Added `Add-PnPEntraIDServicePrincipalAppRoleAssignment`, `Get-PnPEntraIDServicePrincipalAppRoleAssignment`, and `Remove-PnPEntraIDServicePrincipalAppRoleAssignment` cmdlets to manage Entra ID user and group enterprise application assignments with app roles [#5292](https://github.com/pnp/powershell/pull/5292)
- Added `Copy-PnPFileMetadata` to copy Metadata fields (Created, Modified, Author, Editor) between items [#5072](https://github.com/pnp/powershell/pull/5072)
- Added `-NewFileName` parameter to `Convert-PnPFile` cmdlet to choose custom output file name.
Expand Down
173 changes: 173 additions & 0 deletions documentation/New-PnPSiteManageVersionPolicyJob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/New-PnPSiteManageVersionPolicyJob.html
external help file: PnP.PowerShell.dll-Help.xml
title: New-PnPSiteManageVersionPolicyJob
---

# New-PnPSiteManageVersionPolicyJob

## SYNOPSIS

Starts a site-level version policy management job for a SharePoint Online site collection.

## SYNTAX

### TrimUseListPolicy

```powershell
New-PnPSiteManageVersionPolicyJob -Identity <SitePipeBind> -TrimUseListPolicy [-SyncListPolicy] [-FileTypes <String[]>] [-ExcludeDefaultPolicy] [-NoWait] [-Force] [-Connection <PnPConnection>]
```

### SyncListPolicy

```powershell
New-PnPSiteManageVersionPolicyJob -Identity <SitePipeBind> -SyncListPolicy [-FileTypes <String[]>] [-ExcludeDefaultPolicy] [-NoWait] [-Force] [-Connection <PnPConnection>]
```

## DESCRIPTION

Starts a site-level job that can trim versions using existing list version policies, synchronize list version policies across libraries, or do both in a single operation. By default, the cmdlet waits for the tenant operation to complete. Use `-NoWait` to return immediately after the job has been queued.

## EXAMPLES

### EXAMPLE 1
```powershell
New-PnPSiteManageVersionPolicyJob -Identity "https://contoso.sharepoint.com/sites/project-x" -SyncListPolicy
```

Queues a site-level job that synchronizes list version policies across the target site collection.

### EXAMPLE 2
```powershell
New-PnPSiteManageVersionPolicyJob -Identity "https://contoso.sharepoint.com/sites/project-x" -TrimUseListPolicy -SyncListPolicy -Force
```

Queues a site-level job that trims versions using each library's list version policy and then synchronizes list version policies across the site collection, without prompting for confirmation.

### EXAMPLE 3
```powershell
New-PnPSiteManageVersionPolicyJob -Identity "https://contoso.sharepoint.com/sites/project-x" -TrimUseListPolicy -FileTypes "pdf","docx" -ExcludeDefaultPolicy -NoWait
```

Queues a site-level job that trims versions only for the specified file types, excludes the default policy, and returns immediately without waiting for the tenant operation to complete.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

```yaml
Type: PnPConnection
Parameter Sets: (All)

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

### -ExcludeDefaultPolicy
Excludes the default version policy from the site management job. This can be combined with `-FileTypes` to target only specific file types.

```yaml
Type: SwitchParameter
Parameter Sets: (All)

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

### -FileTypes
The file types to include in the version policy management job. When omitted, all file types are included.

```yaml
Type: String[]
Parameter Sets: (All)

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

### -Force
When provided together with `-TrimUseListPolicy`, no confirmation prompt will be shown before creating the job.

```yaml
Type: SwitchParameter
Parameter Sets: (All)

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

### -Identity
The site collection on which to run the version policy management job.

```yaml
Type: SitePipeBind
Parameter Sets: (All)

Required: True
Position: 0
Default value: None
Accept pipeline input: True
Accept wildcard characters: False
```

### -NoWait
Queues the version policy management job and returns immediately instead of waiting for the SharePoint Online tenant operation to complete.

```yaml
Type: SwitchParameter
Parameter Sets: (All)

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

### -SyncListPolicy
Synchronizes the list version policies across document libraries in the site collection.

```yaml
Type: SwitchParameter
Parameter Sets: TrimUseListPolicy, SyncListPolicy

Required: True (SyncListPolicy), False (TrimUseListPolicy)
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrimUseListPolicy
Trims file versions using the existing version policy configured on each document library in the site collection.

```yaml
Type: SwitchParameter
Parameter Sets: TrimUseListPolicy

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

## RELATED LINKS

[Get-PnPSiteFileVersionBatchDeleteJobStatus](Get-PnPSiteFileVersionBatchDeleteJobStatus.md)
Loading
Loading