diff --git a/CHANGELOG.md b/CHANGELOG.md index cc2cf9df2..bf9d013ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `CalendarMemberReadOnly` and `ConnectorsDisabled` as `-ResourceBehaviorOptions` to `New-PnPMicrosoft365Group` [#2929](https://github.com/pnp/powershell/pull/2929) - Added `-Identity` option to `Get-PnPPowerPlatformEnvironment` which allows retrieval of one specific environment by its displayname or id. [#2794](https://github.com/pnp/powershell/pull/2794) - Added `Get-PnPPowerApp` which allows PowerApps to be retrieved [#2794](https://github.com/pnp/powershell/pull/2794) +- Added `-DisableCommenting` to `Set-PnPList` which allows enabling or disabling commenting on a list. [#2939](https://github.com/pnp/powershell/pull/2939) ### Changed @@ -107,7 +108,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed `Add-PnPFieldFromXml` cmdlet. It will now return the correct typed field if the added field was of type `Taxonomy`. [#2926](https://github.com/pnp/powershell/pull/2926) ### Contributors - +- Ganesh Sanap [ganesh-sanap] - Chris R. [ChrisRo89] - Aimery Thomas [a1mery] - Ganesh Sanap [ganesh-sanap] diff --git a/documentation/Set-PnPList.md b/documentation/Set-PnPList.md index b363f3e20..a17871ead 100644 --- a/documentation/Set-PnPList.md +++ b/documentation/Set-PnPList.md @@ -21,7 +21,7 @@ Set-PnPList -Identity [-EnableContentTypes ] [-BreakRole [-EnableAttachments ] [-EnableFolderCreation ] [-EnableVersioning ] [-EnableMinorVersions ] [-MajorVersions ] [-MinorVersions ] [-EnableModeration ] [-DraftVersionVisibility ] [-ReadSecurity ] [-WriteSecurity ] - [-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles ] [-DisableGridEditing ] [-DefaultSensitivityLabelForLibrary ] + [-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles ] [-DisableGridEditing ] [-DisableCommenting ] [-DefaultSensitivityLabelForLibrary ] [-Path ] [-OpenDocumentsMode ] [-Connection ] ``` @@ -468,6 +468,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DisableCommenting +Enable or disable whether commenting is enabled for the list. Set to $true to disable, $false to enable. + +```yaml +Type: Boolean +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Path The new URL path of the list. The parent folder must exist and be in the same site/web. I.e. lists\newname. diff --git a/src/Commands/Lists/SetList.cs b/src/Commands/Lists/SetList.cs index b567740ec..fc1761614 100644 --- a/src/Commands/Lists/SetList.cs +++ b/src/Commands/Lists/SetList.cs @@ -82,6 +82,9 @@ public class SetList : PnPWebCmdlet [Parameter(Mandatory = false)] public bool DisableGridEditing; + + [Parameter(Mandatory = false)] + public bool DisableCommenting; [Parameter(Mandatory = false)] public string Path; @@ -113,7 +116,7 @@ protected override void ExecuteCmdlet() list = newIdentity.GetList(CurrentWeb); } - list.EnsureProperties(l => l.EnableAttachments, l => l.EnableVersioning, l => l.EnableMinorVersions, l => l.Hidden, l => l.EnableModeration, l => l.BaseType, l => l.HasUniqueRoleAssignments, l => l.ContentTypesEnabled, l => l.ExemptFromBlockDownloadOfNonViewableFiles, l => l.DisableGridEditing); + list.EnsureProperties(l => l.EnableAttachments, l => l.EnableVersioning, l => l.EnableMinorVersions, l => l.Hidden, l => l.EnableModeration, l => l.BaseType, l => l.HasUniqueRoleAssignments, l => l.ContentTypesEnabled, l => l.ExemptFromBlockDownloadOfNonViewableFiles, l => l.DisableGridEditing, l => l.DisableCommenting); var enableVersioning = list.EnableVersioning; var enableMinorVersions = list.EnableMinorVersions; @@ -233,6 +236,12 @@ protected override void ExecuteCmdlet() updateRequired = true; } + if (ParameterSpecified(nameof(DisableCommenting))) + { + list.DisableCommenting = DisableCommenting; + updateRequired = true; + } + if (updateRequired) { list.Update();