Skip to content

Commit

Permalink
Merge pull request #2939 from ganesh-sanap/DisableListCommenting
Browse files Browse the repository at this point in the history
Added DisableCommenting parameter to Set-PnPList cmdlet
  • Loading branch information
KoenZomers authored Mar 25, 2023
2 parents f92dacb + e5f2977 commit f58adad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
16 changes: 15 additions & 1 deletion documentation/Set-PnPList.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Set-PnPList -Identity <ListPipeBind> [-EnableContentTypes <Boolean>] [-BreakRole
[-EnableAttachments <Boolean>] [-EnableFolderCreation <Boolean>] [-EnableVersioning <Boolean>]
[-EnableMinorVersions <Boolean>] [-MajorVersions <UInt32>] [-MinorVersions <UInt32>]
[-EnableModeration <Boolean>] [-DraftVersionVisibility <DraftVisibilityType>] [-ReadSecurity <ListReadSecurity>] [-WriteSecurity <ListWriteSecurity>]
[-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles <Boolean>] [-DisableGridEditing <Boolean>] [-DefaultSensitivityLabelForLibrary <SensitivityLabelPipeBind>]
[-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles <Boolean>] [-DisableGridEditing <Boolean>] [-DisableCommenting <Boolean>] [-DefaultSensitivityLabelForLibrary <SensitivityLabelPipeBind>]
[-Path <String>] [-OpenDocumentsMode <DocumentLibraryOpenDocumentsInMode>] [-Connection <PnPConnection>]
```

Expand Down Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion src/Commands/Lists/SetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -233,6 +236,12 @@ protected override void ExecuteCmdlet()
updateRequired = true;
}

if (ParameterSpecified(nameof(DisableCommenting)))
{
list.DisableCommenting = DisableCommenting;
updateRequired = true;
}

if (updateRequired)
{
list.Update();
Expand Down

0 comments on commit f58adad

Please sign in to comment.