Skip to content

Commit 5604501

Browse files
Learn Editor: Update Set-SPOListVersionPolicy.md
1 parent 2e51f13 commit 5604501

File tree

1 file changed

+197
-10
lines changed

1 file changed

+197
-10
lines changed

sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Set-SPOListVersionPolicy.md

Lines changed: 197 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,23 @@ Sets the version policy setting on the document library.
1919

2020
## SYNTAX
2121

22+
### SetPolicy
2223
```
2324
Set-SPOListVersionPolicy [-Site] <SpoSitePipeBind> -List <SPOListPipeBind>
2425
-EnableAutoExpirationVersionTrim <Boolean> [-ExpireVersionsAfterDays <Int32>] [-MajorVersionLimit <Int32>]
25-
[-MajorWithMinorVersionsLimit <Int32>] [<CommonParameters>]
26+
[-MajorWithMinorVersionsLimit <Int32>] [-FileTypes <String[]>] [<CommonParameters>]
27+
```
28+
29+
### RemovePolicy
30+
```
31+
Set-SPOListVersionPolicy [-Site] <SpoSitePipeBind> -List <SPOListPipeBind>
32+
-RemoveVersionExpirationFileTypeOverride <String[]> [<CommonParameters>]
33+
```
34+
35+
### SyncPolicy
36+
```
37+
Set-SPOListVersionPolicy [-Site] <SpoSitePipeBind> -List <SPOListPipeBind> [-FileTypes <String[]>] [-Sync]
38+
[-ExcludeDefaultPolicy] [<CommonParameters>]
2639
```
2740

2841
## DESCRIPTION
@@ -51,7 +64,79 @@ Example 2 sets manual version histroy limits on the document library called "Doc
5164
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 500 -MajorWithMinorVersionsLimit 20 -ExpireVersionsAfterDays 0
5265
```
5366

54-
Example 3 sets manual version histroy limits on the document library called "Documents" by limiting the number of versions with no time limits. The new document libraries will use this version setting.
67+
Example 3 sets manual version histroy limits on the document library called "Documents" by limiting the number of versions with no time limits.
68+
69+
### Example 4
70+
```powershell
71+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -EnableAutoExpirationVersionTrim $true -FileTypes @("Video", "Audio")
72+
```
73+
Example 4 sets automatic version history limit override for video and audio file types on the document library called "Documents".
74+
75+
### EXAMPLE 5
76+
77+
```powershell
78+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 500 -MajorWithMinorVersionsLimit 20 -ExpireVersionsAfterDays 30 -FileTypes @("Video", "Audio")
79+
```
80+
81+
Example 5 sets manual version history limit override for video and audio file types on the document library called "Documents" by limiting the number of versions and the time (in days) versions are kept.
82+
83+
### EXAMPLE 6
84+
85+
```powershell
86+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -EnableAutoExpirationVersionTrim $false -MajorVersionLimit 500 -MajorWithMinorVersionsLimit 20 -ExpireVersionsAfterDays 0 -FileTypes @("Video", "Audio")
87+
```
88+
89+
Example 6 sets manual version history limit override for video and audio file types on the document library called "Documents" by limiting the number of versions with no time limits.
90+
91+
### EXAMPLE 7
92+
93+
```powershell
94+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Sync
95+
```
96+
97+
Example 7 sets the version history limits (include file type overrides) to that of the tenant or site (if the site this document library is in has broken inheritance for version history limits).
98+
99+
### EXAMPLE 8
100+
101+
```powershell
102+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Sync -FileTypes @("Video", "Audio")
103+
```
104+
105+
Example 8 sets the default version history limits and overrides for video and audio file types to that of the tenant or site (if the site this document library is in has broken inheritance for version history limits).
106+
107+
### EXAMPLE 9
108+
109+
```powershell
110+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Sync -FileTypes @()
111+
```
112+
113+
Example 9 sets the default version history limit to that of the tenant or site (if the site this document library is in has broken inheritance for version history limits).
114+
115+
### EXAMPLE 10
116+
117+
```powershell
118+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Sync -FileTypes @("Video", "Audio") -ExcludeDefaultPolicy
119+
```
120+
121+
Example 10 sets the only the version history limit overrides for video and audio file types to that of the tenant or site (if the site this document library is in has broken inheritance for version history limits).
122+
123+
### EXAMPLE 11
124+
125+
126+
```powershell
127+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -Sync -ExcludeDefaultPolicy
128+
```
129+
130+
Example 10 sets the version history limit overrides for all file types to that of the tenant or site (if the site this document library is in has broken inheritance for version history limits).
131+
132+
### EXAMPLE 12
133+
134+
135+
```powershell
136+
Set-SPOListVersionPolicy -Site https://contoso.sharepoint.com/sites/site1 -List "Documents" -RemoveVersionExpirationFileTypeOverride @("Video", "Audio")
137+
```
138+
139+
Example 12 removes the version history limit overrides for video and audio file types so that they follow the default version history limits.
55140

56141
## PARAMETERS
57142

@@ -77,8 +162,8 @@ The valid values are:
77162
PARAMVALUE: $true | $false
78163

79164
```yaml
80-
Type: System.Boolean
81-
Parameter Sets: (All)
165+
Type: Boolean
166+
Parameter Sets: SetPolicy
82167
Aliases:
83168

84169
Required: True
@@ -88,6 +173,26 @@ Accept pipeline input: False
88173
Accept wildcard characters: False
89174
```
90175
176+
### -ExcludeDefaultPolicy
177+
> Applicable: SharePoint Online
178+
179+
Indicates whether to synchronize the default version policy to the default policy of the tenant or the site (if the site this document library is in has broken inheritance for version history limits).
180+
181+
> [!NOTE]
182+
> This feature is currently in preview and may not be available in your tenant.
183+
184+
```yaml
185+
Type: SwitchParameter
186+
Parameter Sets: SyncPolicy
187+
Aliases:
188+
189+
Required: False
190+
Position: Named
191+
Default value: None
192+
Accept pipeline input: False
193+
Accept wildcard characters: False
194+
```
195+
91196
### -ExpireVersionsAfterDays
92197
93198
> Applicable: SharePoint Online
@@ -96,8 +201,43 @@ When version history limits are managed manually (`EnableAutoExpirationVersionTr
96201
PARAMVALUE: Int32
97202

98203
```yaml
99-
Type: System.Int32
100-
Parameter Sets: (All)
204+
Type: Int32
205+
Parameter Sets: SetPolicy
206+
Aliases:
207+
208+
Required: False
209+
Position: Named
210+
Default value: None
211+
Accept pipeline input: False
212+
Accept wildcard characters: False
213+
```
214+
215+
### -FileTypes
216+
> Applicable: SharePoint Online
217+
218+
An array of file type names. The supported file type names are:
219+
220+
- Audio
221+
222+
- OutlookPST
223+
224+
- Video
225+
226+
Apply the version history limits to a set of file types so that they no longer follow the default version history limits. It is used in combination with the following parameters:
227+
228+
- EnableAutoExpirationVersionTrim
229+
230+
- MajorVersionLimit
231+
232+
- ExpireVersionsAfterDays
233+
234+
Or apply the version history limit override for the file types of the tenant or the site (if the site this document library is in has broken inheritance for version history limits) by using the **Sync** parameter. For more information about this option, please refer to the documentation for the **Sync** parameter.
235+
236+
237+
238+
```yaml
239+
Type: String[]
240+
Parameter Sets: SetPolicy, SyncPolicy
101241
Aliases:
102242
103243
Required: False
@@ -131,8 +271,8 @@ When version history limits are managed manually (`EnableAutoExpirationVersionTr
131271
PARAMVALUE: Int32
132272

133273
```yaml
134-
Type: System.Int32
135-
Parameter Sets: (All)
274+
Type: Int32
275+
Parameter Sets: SetPolicy
136276
Aliases:
137277
138278
Required: False
@@ -150,8 +290,8 @@ When version history limits are managed manually (`EnableAutoExpirationVersionTr
150290
PARAMVALUE: Int32
151291

152292
```yaml
153-
Type: System.Int32
154-
Parameter Sets: (All)
293+
Type: Int32
294+
Parameter Sets: SetPolicy
155295
Aliases:
156296
157297
Required: False
@@ -161,6 +301,23 @@ Accept pipeline input: False
161301
Accept wildcard characters: False
162302
```
163303

304+
### -RemoveVersionExpirationFileTypeOverride
305+
An array of file type names. Removes the version history limits to a set of file types so that they will follow the default version history limits.
306+
307+
308+
309+
```yaml
310+
Type: String[]
311+
Parameter Sets: RemovePolicy
312+
Aliases:
313+
314+
Required: True
315+
Position: Named
316+
Default value: None
317+
Accept pipeline input: False
318+
Accept wildcard characters: False
319+
```
320+
164321
### -Site
165322

166323
> Applicable: SharePoint Online
@@ -179,6 +336,36 @@ Accept pipeline input: True (ByValue)
179336
Accept wildcard characters: False
180337
```
181338

339+
### -Sync
340+
Apply the version history limits of the tenant or the site (if the site this document library is in has broken inheritance for version history limits).
341+
342+
You may use the following parameters in combination to update only the default policy or a set of file type overrides:
343+
344+
- ExcludeDefaultPolicy: if set, it will not update the default policy.
345+
346+
- FileTypes:
347+
348+
- if set, it will update the specified file types;
349+
350+
- if not set, it will update all file type overrides;
351+
352+
- if set to an empty array (i.e. `@()`), it will not update any file type overrides.
353+
354+
> [!NOTE]
355+
> This feature is currently in preview and may not be available in your tenant.
356+
357+
```yaml
358+
Type: SwitchParameter
359+
Parameter Sets: SyncPolicy
360+
Aliases:
361+
362+
Required: False
363+
Position: Named
364+
Default value: None
365+
Accept pipeline input: False
366+
Accept wildcard characters: False
367+
```
368+
182369
### CommonParameters
183370

184371
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

0 commit comments

Comments
 (0)