Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new versioning cmdlets. #3799

Merged
merged 21 commits into from
Mar 1, 2024
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
27 changes: 23 additions & 4 deletions documentation/Get-PnPFileVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Retrieves the previous versions of a file. Does not retrieve the current version
## SYNTAX

```powershell
Get-PnPFileVersion -Url <String> [-Connection <PnPConnection>]
Get-PnPFileVersion -Url <String> [-UseVersionExpirationReport] [-Connection <PnPConnection>]
```

## DESCRIPTION
Retrieves the version history of a file, not including its current version. To get the current version use the MajorVersion and MinorVersion properties returned from Get-PnPFile.

It can optionally return the version expiration report, which contains the versions' SnapshotDate (or estimated SnapshotDate if it is not available) and estimated ExpirationDate based on the Automatic Version History Limits.

## EXAMPLES

### EXAMPLE 1
Expand All @@ -32,11 +34,18 @@ Retrieves the file version information for the specified file.

### EXAMPLE 2
```powershell
Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx"
Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx"
```

Retrieves the file version information for the specified file by specifying the path to the site and the document library's URL.

### EXAMPLE 3
```powershell
Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx" -UseVersionExpirationReport
```

Retrieves the version expiration report for the specified file.

## PARAMETERS

### -Connection
Expand Down Expand Up @@ -66,10 +75,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -UseVersionExpirationReport
Returns the file version expiration report. The versions contained in the report has the SnapshotDate (or estimated SnapshotDate if it is not available) and estimated ExpirationDate based on the Automatic Version History Limits.

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

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)


Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPLibraryFileVersionExpirationReportJobProgress.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPLibraryFileVersionExpirationReportJobProgress
---

# Get-PnPLibraryFileVersionExpirationReportJobProgress

## SYNOPSIS

Gets the status for a file version usage report generation job for a document library.

## SYNTAX

```powershell
Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity <ListPipeBind> -ReportUrl <string>
```

## DESCRIPTION

Gets the status for a file version usage report generation job for a document library.

## EXAMPLES

### EXAMPLE 1
```powershell
Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
```

Gets the status for a file version usage report generation job for a document library.

## PARAMETERS

### -Identity
The ID, name or Url (Lists/MyList) of the document library to get the job status on.

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

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

### -ReportUrl
The URL of the report to get the job status on.

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

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
53 changes: 53 additions & 0 deletions documentation/Get-PnPSiteFileVersionExpirationReportJobProgress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSiteFileVersionExpirationReportJobProgress.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPSiteFileVersionExpirationReportJobProgress
---

# Get-PnPSiteFileVersionExpirationReportJobProgress

## SYNOPSIS

Gets the status for a file version usage report generation job for a site collection.

## SYNTAX

```powershell
Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl <string>
```

## DESCRIPTION

Gets the status for a file version usage report generation job for a site collection.

## EXAMPLES

### EXAMPLE 1
```powershell
Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
```

Gets the status for a file version usage report generation job for a site collection.

## PARAMETERS

### -ReportUrl
The URL of the report to get the job status on.

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

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
88 changes: 88 additions & 0 deletions documentation/New-PnPLibraryFileVersionBatchDeleteJob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionBatchDeleteJob.html
external help file: PnP.PowerShell.dll-Help.xml
title: New-PnPLibraryFileVersionBatchDeleteJob
---

# New-PnPLibraryFileVersionBatchDeleteJob

## SYNOPSIS

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

## SYNTAX

```powershell
New-PnPLibraryFileVersionBatchDeleteJob -Identity <ListPipeBind> -DeleteBeforeDays <int> [-Force]
```

## DESCRIPTION

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

## EXAMPLES

### EXAMPLE 1
```powershell
New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360
```

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

### EXAMPLE 2
```powershell
New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 -Force
```

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

## PARAMETERS

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

```yaml
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.

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

Required: True
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.

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

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
67 changes: 67 additions & 0 deletions documentation/New-PnPLibraryFileVersionExpirationReportJob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionExpirationReportJob.html
external help file: PnP.PowerShell.dll-Help.xml
title: New-PnPLibraryFileVersionExpirationReportJob
---

# New-PnPLibraryFileVersionExpirationReportJob

## SYNOPSIS

Starts generating file version usage report for a document library.

## SYNTAX

```powershell
New-PnPLibraryFileVersionExpirationReportJob -Identity <ListPipeBind> -ReportUrl <string>
```

## DESCRIPTION

Starts generating file version usage report for a document library.

## EXAMPLES

### EXAMPLE 1
```powershell
New-PnPLibraryFileVersionExpirationReportJob -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
```

Starts generating file version usage report for a document library, saving the result to a csv file within the site collection.

## PARAMETERS

### -Identity
The ID, name or Url (Lists/MyList) of the document library to gather a file version usage report on.

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

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

### -ReportUrl
The URL of the report to save to.

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

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Loading
Loading