Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 44f9fd7

Browse files
Merge pull request #1503 from erwinvanhunen/dev
Added properties
2 parents e495aec + 1fbd1a6 commit 44f9fd7

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2323

2424
### Changed
2525

26-
- Added additional properties to Set-PnPList
26+
- Added additional properties to Set-PnPList: Description, EnableFolderCreation, ForceCheckout, ListExperience
2727
- ALM Cmdlets (Add-PnPApp, etc.) now allow for specifying the app title instead of only an id.
2828
- Updated Set-PnPInPlaceRecordsManagement cmdlet to use a -Enabled parameter instead of -On and -Off
2929
- Add-PnPClientSideWebPart and Add-PnPClientSideText now return the client side component added

Commands/Lists/SetList.cs

+30-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ public bool
6565
[Parameter(Mandatory = false, HelpMessage = "Hide the list from the SharePoint UI. Set to $true to hide, $false to show.")]
6666
public bool Hidden;
6767

68+
[Parameter(Mandatory = false, HelpMessage = "Enable or disable force checkout. Set to $true to enable, $false to disable.")]
69+
public bool ForceCheckout;
70+
71+
#if !ONPREMISES
72+
[Parameter(Mandatory = false, HelpMessage = "Set the list experience: Auto, NewExperience or ClassExperience")]
73+
public ListExperience ListExperience;
74+
#endif
75+
6876
[Parameter(Mandatory = false, HelpMessage = "Enable or disable attachments. Set to $true to enable, $false to disable.")]
6977
public bool EnableAttachments;
7078

@@ -148,31 +156,49 @@ protected override void ExecuteCmdlet()
148156
isDirty = true;
149157
}
150158

151-
if(MyInvocation.BoundParameters.ContainsKey("Description"))
159+
if (MyInvocation.BoundParameters.ContainsKey("Description"))
152160
{
153161
list.Description = Description;
154162
isDirty = true;
155163
}
156164

157-
if(MyInvocation.BoundParameters.ContainsKey("EnableFolderCreation"))
165+
if (MyInvocation.BoundParameters.ContainsKey("EnableFolderCreation"))
158166
{
159167
list.EnableFolderCreation = EnableFolderCreation;
160168
isDirty = true;
161169
}
162170

171+
if (MyInvocation.BoundParameters.ContainsKey("ForceCheckout"))
172+
{
173+
list.ForceCheckout = ForceCheckout;
174+
isDirty = true;
175+
}
176+
177+
#if !ONPREMISES
178+
if (MyInvocation.BoundParameters.ContainsKey("ListExperience"))
179+
{
180+
list.ListExperienceOptions = ListExperience;
181+
isDirty = true;
182+
}
183+
#endif
184+
163185
if (isDirty)
164186
{
165187
list.Update();
166188
ClientContext.ExecuteQueryRetry();
167189
}
168190
isDirty = false;
169191

192+
193+
194+
170195
if (list.EnableVersioning)
171196
{
172197
// list or doclib?
173198

174199
if (list.BaseType == BaseType.DocumentLibrary)
175200
{
201+
176202
if (MyInvocation.BoundParameters.ContainsKey("MajorVersions"))
177203
{
178204
list.MajorVersionLimit = (int)MajorVersions;
@@ -193,6 +219,8 @@ protected override void ExecuteCmdlet()
193219
isDirty = true;
194220
}
195221
}
222+
223+
196224
}
197225
if (isDirty)
198226
{

0 commit comments

Comments
 (0)