In this “SharePoint sensitivity labels” blog, we will learn how to troubleshoot the error “The sensitivity label ‘GSD First Test Sensitivity Label’ is published by label policies and cannot be deleted. The following label policies have published this sensitivity label: GSD First Sensitivity Label Test – Policy.”
The error message is shown below in the picture:
Steps to delete a sensitivity label from the compliance center -SharePoint sensitivity labels
Log in to the Microsoft Purview (previously known as Microsoft 365 Compliance Center).
Information protection – Microsoft 365 compliance
Click on the “Information Protection” link from the left navigation area.
Below we can see the dashboard of all sensitivity labels.
Select any of the sensitivity labels displayed over there.
Double-click on the selected label.
Click on the “Delete Label” button.
Once you click on the “Delete Label” button, we will get the warning message
“Are you sure you want to delete the selected object(s)?” with the “Yes” and “No” buttons.
Click on the “Yes” button.
Once, we click on the “Yes” button we will not be able to delete the sensitivity label, the error will say:
“The sensitivity label ‘GSD First Test Sensitivity Label’ is published by label policies and cannot be deleted. The following label policies have published this sensitivity label: GSD First Sensitivity Label Test – Policy.”
Then, how to fix this error and move on to the deletion.
How to fix the error “The sensitivity label ‘GSD First Test Sensitivity Label’ is published by label policies and cannot be deleted.”?
In order to fix the above-mentioned error, first, we need to delete the policy for the sensitivity label which was published but unfortunately, there is no UI in the Microsoft Purview(compliance center) to see the published policy for a sensitivity label as the policy is the background process for a sensitivity label. In this case, we need to take the help of the PowerShell commands.
In the PowerShell part, we have 4 steps:
- Get All Sensitivity Labels using the Get-Label command
- Get All Policies using the Get-LabelPolicy command
- Delete a Policy using the Remove-LabelPolicy command
- Delete a Label using the Remove-Label command
Get All Sensitivity Labels using the Get-Label command – SharePoint sensitivity labels
Referring to the Get sensitivity labels using PowerShell script article list out all the labels.
Install-Module -Name ExchangeOnlineManagement -RequiredVersion 3.2.0 #2.0.5 This version doesn't support. Import-Module ExchangeOnlineManagement Connect-IPPSSession #This will ask you to enter your Global Admin credential Get-Label |Format-Table -Property Guid, DisplayName, Name
Get Sensitivity Labels using the Get-Label PowerShell command
Now, note down the GUID id of the sensitivity label which you want to delete.
Get All Policies using the Get-LabelPolicy command – SharePoint sensitivity labels
Similarly using the below command get all label policies:
Get-LabelPolicy | Format-Table -Property Guid, Name, DisplayName
Get Sensitivity Labels Policy using the Get-LabelPolicy PowerShell command
Now, note down the GUID ID and the Name of the policy which you want to delete.
Delete a Policy using the Remove-LabelPolicy command – SharePoint sensitivity labels
Use the below command to delete a sensitivity policy:
Remove-LabelPolicy -Identity "GSD First Sensitivity Label Test - Policy"
Note:
- Here in the Identity parameter, we can pass either GUID or the name of the policy.
Delete a Label using the Remove-Label command – SharePoint sensitivity labels
Using the below command, delete the sensitivity label:
Remove-Label -Identity "GSD First Test Sensitivity Label"
Note:
- Here also, in the Identity parameter, we can pass either GUID or the name of the policy.
Now, if we go to the sensitivity label dashboard in the Microsoft Purview, we can see that the sensitivity label “GSD First Test Sensitivity Label” has been deleted, we don’t see the error anymore.
Summary: What we have learned here (SharePoint sensitivity labels)?
Thus, in this article, we have learned the below with respect to troubleshooting the error “The sensitivity label ‘GSD First Test Sensitivity Label’ is published by label policies and cannot be deleted. The following label policies have published this sensitivity label: GSD First Sensitivity Label Test – Policy.”:
- How to fix the sensitivity label deletion error – the sensitivity label is published by label policies and cannot be deleted
- How to get sensitivity label using the PowerShell script
- How to get sensitivity label policy using the PowerShell script
- How to remove sensitivity label policy using the PowerShell script
- How to remove sensitivity label using the PowerShell script
See Also: SharePoint sensitivity labels
You may also like the below SharePoint sensitivity labels articles:
- Apply sensitivity label in SharePoint using Postman tool
- Get sensitivity labels using PowerShell script
- Enable Sensitivity label for Groups, Sites & Teams
Reference: SharePoint sensitivity labels
- For more updates on the sensitivity label PowerShell command, you can refer to this Microsoft article – Remove-Label
Hello, you need to update your documentation. The 2.0.5 version of the ExchangeOnlineManagement module no longer works – it returns an error. The version should now be 3.2.0.
Thank you so much for your comment. I have now updated the article with the 3.2.0 version (ExchangeOnlineManagement).