diff --git a/documentation/Set-PnPLabel.md b/documentation/Set-PnPLabel.md index d8b73e400..42ebe1a4d 100644 --- a/documentation/Set-PnPLabel.md +++ b/documentation/Set-PnPLabel.md @@ -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 @@ -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 diff --git a/src/Commands/InformationManagement/SetLabel.cs b/src/Commands/InformationManagement/SetLabel.cs index fb4d44163..f38efa1af 100644 --- a/src/Commands/InformationManagement/SetLabel.cs +++ b/src/Commands/InformationManagement/SetLabel.cs @@ -2,6 +2,7 @@ using Microsoft.SharePoint.Client; using PnP.PowerShell.Commands.Base.PipeBinds; using System.Linq; +using System; namespace PnP.PowerShell.Commands.InformationManagement { @@ -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; @@ -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 {