Skip to content

Commit 836de12

Browse files
authored
Merge pull request #3799 from blarrywangmsft/AddVersioningCommands
Add new versioning cmdlets.
2 parents 3b3408b + a967c4a commit 836de12

19 files changed

+891
-6
lines changed

documentation/Get-PnPFileVersion.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ Retrieves the previous versions of a file. Does not retrieve the current version
1515
## SYNTAX
1616

1717
```powershell
18-
Get-PnPFileVersion -Url <String> [-Connection <PnPConnection>]
18+
Get-PnPFileVersion -Url <String> [-UseVersionExpirationReport] [-Connection <PnPConnection>]
1919
```
2020

2121
## DESCRIPTION
2222
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.
2323

24+
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.
25+
2426
## EXAMPLES
2527

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

3335
### EXAMPLE 2
3436
```powershell
35-
Get-PnPFileVersion -Url "/sites/blah/Shared Documents/MyDocument.docx"
37+
Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx"
3638
```
3739

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

42+
### EXAMPLE 3
43+
```powershell
44+
Get-PnPFileVersion -Url "/sites/marketing/Shared Documents/MyDocument.docx" -UseVersionExpirationReport
45+
```
46+
47+
Retrieves the version expiration report for the specified file.
48+
4049
## PARAMETERS
4150

4251
### -Connection
@@ -66,10 +75,20 @@ Accept pipeline input: False
6675
Accept wildcard characters: False
6776
```
6877
78+
### -UseVersionExpirationReport
79+
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.
80+
81+
```yaml
82+
Type: SwitchParameter
83+
Parameter Sets: (All)
6984

85+
Required: False
86+
Position: Named
87+
Default value: None
88+
Accept pipeline input: False
89+
Accept wildcard characters: False
90+
```
7091
7192
## RELATED LINKS
7293
7394
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
74-
75-
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPLibraryFileVersionExpirationReportJobProgress.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Get-PnPLibraryFileVersionExpirationReportJobProgress
8+
---
9+
10+
# Get-PnPLibraryFileVersionExpirationReportJobProgress
11+
12+
## SYNOPSIS
13+
14+
Gets the status for a file version usage report generation job for a document library.
15+
16+
## SYNTAX
17+
18+
```powershell
19+
Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity <ListPipeBind> -ReportUrl <string>
20+
```
21+
22+
## DESCRIPTION
23+
24+
Gets the status for a file version usage report generation job for a document library.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
```powershell
30+
Get-PnPLibraryFileVersionExpirationReportJobProgress -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
31+
```
32+
33+
Gets the status for a file version usage report generation job for a document library.
34+
35+
## PARAMETERS
36+
37+
### -Identity
38+
The ID, name or Url (Lists/MyList) of the document library to get the job status on.
39+
40+
```yaml
41+
Type: ListPipeBind
42+
Parameter Sets: (All)
43+
44+
Required: True
45+
Position: 0
46+
Default value: None
47+
Accept pipeline input: True (ByValue)
48+
Accept wildcard characters: False
49+
```
50+
51+
### -ReportUrl
52+
The URL of the report to get the job status on.
53+
54+
```yaml
55+
Type: string
56+
Parameter Sets: (All)
57+
58+
Required: True
59+
Position: Named
60+
Default value: None
61+
Accept pipeline input: False
62+
Accept wildcard characters: False
63+
```
64+
65+
## RELATED LINKS
66+
67+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSiteFileVersionExpirationReportJobProgress.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Get-PnPSiteFileVersionExpirationReportJobProgress
8+
---
9+
10+
# Get-PnPSiteFileVersionExpirationReportJobProgress
11+
12+
## SYNOPSIS
13+
14+
Gets the status for a file version usage report generation job for a site collection.
15+
16+
## SYNTAX
17+
18+
```powershell
19+
Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl <string>
20+
```
21+
22+
## DESCRIPTION
23+
24+
Gets the status for a file version usage report generation job for a site collection.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
```powershell
30+
Get-PnPSiteFileVersionExpirationReportJobProgress -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
31+
```
32+
33+
Gets the status for a file version usage report generation job for a site collection.
34+
35+
## PARAMETERS
36+
37+
### -ReportUrl
38+
The URL of the report to get the job status on.
39+
40+
```yaml
41+
Type: string
42+
Parameter Sets: (All)
43+
44+
Required: True
45+
Position: Named
46+
Default value: None
47+
Accept pipeline input: False
48+
Accept wildcard characters: False
49+
```
50+
51+
## RELATED LINKS
52+
53+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionBatchDeleteJob.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: New-PnPLibraryFileVersionBatchDeleteJob
8+
---
9+
10+
# New-PnPLibraryFileVersionBatchDeleteJob
11+
12+
## SYNOPSIS
13+
14+
Starts a file version batch trim job for a document library.
15+
16+
## SYNTAX
17+
18+
```powershell
19+
New-PnPLibraryFileVersionBatchDeleteJob -Identity <ListPipeBind> -DeleteBeforeDays <int> [-Force]
20+
```
21+
22+
## DESCRIPTION
23+
24+
Starts a file version batch trim job for a document library.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
```powershell
30+
New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360
31+
```
32+
33+
Starts a file version batch trim job that will delete all file verions that are over 360 days old in the document library.
34+
35+
### EXAMPLE 2
36+
```powershell
37+
New-PnPLibraryFileVersionBatchDeleteJob -Identity "Documents" -DeleteBeforeDays 360 -Force
38+
```
39+
40+
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.
41+
42+
## PARAMETERS
43+
44+
### -Identity
45+
The ID, name or Url (Lists/MyList) of the document library to perform the trimming on.
46+
47+
```yaml
48+
Type: ListPipeBind
49+
Parameter Sets: (All)
50+
51+
Required: True
52+
Position: 0
53+
Default value: None
54+
Accept pipeline input: True (ByValue)
55+
Accept wildcard characters: False
56+
```
57+
58+
### -DeleteBeforeDays
59+
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.
60+
61+
```yaml
62+
Type: int
63+
Parameter Sets: (All)
64+
65+
Required: True
66+
Position: Named
67+
Default value: None
68+
Accept pipeline input: False
69+
Accept wildcard characters: False
70+
```
71+
72+
### -Force
73+
When provided, no confirmation prompts will be shown to the user.
74+
75+
```yaml
76+
Type: SwitchParameter
77+
Parameter Sets: (All)
78+
79+
Required: False
80+
Position: Named
81+
Default value: None
82+
Accept pipeline input: False
83+
Accept wildcard characters: False
84+
```
85+
86+
## RELATED LINKS
87+
88+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/New-PnPLibraryFileVersionExpirationReportJob.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: New-PnPLibraryFileVersionExpirationReportJob
8+
---
9+
10+
# New-PnPLibraryFileVersionExpirationReportJob
11+
12+
## SYNOPSIS
13+
14+
Starts generating file version usage report for a document library.
15+
16+
## SYNTAX
17+
18+
```powershell
19+
New-PnPLibraryFileVersionExpirationReportJob -Identity <ListPipeBind> -ReportUrl <string>
20+
```
21+
22+
## DESCRIPTION
23+
24+
Starts generating file version usage report for a document library.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
```powershell
30+
New-PnPLibraryFileVersionExpirationReportJob -Identity "Documents" -ReportUrl "https://contoso.sharepoint.com/sites/reports/MyReports/VersionReport.csv"
31+
```
32+
33+
Starts generating file version usage report for a document library, saving the result to a csv file within the site collection.
34+
35+
## PARAMETERS
36+
37+
### -Identity
38+
The ID, name or Url (Lists/MyList) of the document library to gather a file version usage report on.
39+
40+
```yaml
41+
Type: ListPipeBind
42+
Parameter Sets: (All)
43+
44+
Required: True
45+
Position: 0
46+
Default value: None
47+
Accept pipeline input: True (ByValue)
48+
Accept wildcard characters: False
49+
```
50+
51+
### -ReportUrl
52+
The URL of the report to save to.
53+
54+
```yaml
55+
Type: string
56+
Parameter Sets: (All)
57+
58+
Required: True
59+
Position: Named
60+
Default value: None
61+
Accept pipeline input: False
62+
Accept wildcard characters: False
63+
```
64+
65+
## RELATED LINKS
66+
67+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

0 commit comments

Comments
 (0)