Skip to content

Commit

Permalink
Deprecates BlockEdit and BlockDeletion parameters of Set-PnPLabel. Cl…
Browse files Browse the repository at this point in the history
…oses #2932 (#2934)
  • Loading branch information
martinlingstuyl authored Mar 24, 2023
1 parent bf46387 commit 11a30b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 2 additions & 9 deletions documentation/Set-PnPLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,10 @@ Set-PnPLabel -List "Demo List" -Label "Project Documentation" -SyncToItems $true

This sets an O365 label on the specified list or library and sets the label to all the items in the list and library as well.

### EXAMPLE 3
```powershell
Set-PnPLabel -List "Demo List" -Label "Project Documentation" -BlockDelete $true -BlockEdit $true
```

This sets an O365 label on the specified list or library. Next, it also blocks the ability to either edit or delete the item.

## PARAMETERS

### -BlockDeletion
Block deletion of items in the library
Block deletion of items in the library. This parameter has been deprecated because overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.

```yaml
Type: Boolean
Expand All @@ -62,7 +55,7 @@ Accept wildcard characters: False
```
### -BlockEdit
Block editing of items in the library
Block editing of items in the library. This parameter has been deprecated because overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.
```yaml
Type: Boolean
Expand Down
8 changes: 6 additions & 2 deletions src/Commands/InformationManagement/SetLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base.PipeBinds;
using System.Linq;
using System;

namespace PnP.PowerShell.Commands.InformationManagement
{
Expand All @@ -17,9 +18,11 @@ public class SetLabel : PnPSharePointCmdlet
[Parameter(Mandatory = false)]
public bool SyncToItems;

[Obsolete("Overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.")]
[Parameter(Mandatory = false)]
public bool BlockDeletion;

[Obsolete("Overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.")]
[Parameter(Mandatory = false)]
public bool BlockEdit;

Expand All @@ -30,9 +33,10 @@ protected override void ExecuteCmdlet()

if (list != null)
{
if (availableTags.FirstOrDefault(tag => tag.TagName.ToString() == Label) != null)
var availableTag = availableTags.FirstOrDefault(tag => tag.TagName.ToString() == Label);
if (availableTag != null)
{
list.SetComplianceTag(Label, BlockDeletion, BlockEdit, SyncToItems);
list.SetComplianceTag(Label, availableTag.BlockDelete, availableTag.BlockEdit, SyncToItems);
}
else
{
Expand Down

0 comments on commit 11a30b7

Please sign in to comment.