How Do I Programmaticly Remove the Delete Button Again

Reading Time: 5 minutes

If your organization is using the Security & Compliance retentiveness labels to employ retention across Role 365 workloads,  you may somewhen notice yourself needing to remove an existing characterization definition for one reason or some other. Perchance you had a label fix for a test scenario and now desire to remove it, or maybe the Data Management squad changed their mind on the retention label configuration and want some labels to be removed. This is real-earth, it happens.

This post is Non referring to Azure Information Protection labels. Deleting them is a completely dissimilar process.

This post is referring to removing a label definition from the Security & Compliance Center, NOT removing a label from a document.

Although deleting a label definition sounds like a picayune affair to practise, depending on your verbal scenario, the behavior can exist a footling disruptive. As an administrator, you need to understand information technology.

Scenarios

  • Yous've created the label and oasis't published information technology in a policy still
  • You've created the label, published it in a policy, merely haven't applied information technology to content however
  • You've created the label, published information technology in a policy, and applied it to content
  • Special mention: to a higher place but with a Record label

I'll go thru each of these scenarios and conclude with my recommendation for removing retention labels. 🙂


Scenario 1: Created a label, not yet published

The start scenario is the simplest to address. Simply edit the label and select the Delete label choice. No fuss, no muss. (UNLESS the characterization declared content as a record – for this, check out scenario iv)

DeleteNeverUsedLabel

Notation: if you practise delete a characterization similar this, it takes a while for it to be completely removed from the arrangement. If y'all try to immediately recreate a label with the same name, it will throw an error saying the label already exists. My testing has shown it takes ~1 twenty-four hours for it to be completely removed.


Scenario ii: Created a label, published it, but not used on content

I've created a characterization calledJoanne Characterization 1 and included information technology in a Memory policypublished to all locations in my tenant.

If y'all effort to delete the label direct thru the UI (Classifications section in the Security & Compliance Center) or via PowerShell with theRemove-ComplianceTag cmdlet, you lot volition get the fault message(due south) below:

Removing a label in use

Removing a label in use with PowerShell

Note: for these cmdlets, connect to the Security & Compliance Middle. Instructions

Yous receive this error considering the characterization is role of a retention policy and even though I haven't applied the label to whatever content withal, information technology is technically "in-utilize". It is a 2-stride process to delete it.

Step 1: Remove the label from the policy OR delete the policy if the label was the but one in the policy

Remove label from Policy Step 2: Remove the label either thru the UI or with PowerShell

Thru the User interface:

DeleteNeverUsedLabel

With PowerShell:

Remove a label not in use


Scenario 3: Created a characterization, published it, applied information technology to content

To demonstrate this scenario, I've created a label, Joanne Label i,published to all locations across my tenant, and uploaded some documents into a library on a modernistic squad site, Label Test Site. I've applied the label to iii documents.

Labeled Documents

If I endeavour to delete the retentivity characterization, I will receive the same error every bit described in Scenario 2 to a higher place. I need to go thru the same steps to remove information technology:

Step 1: Remove the label from the policy OR delete the policy if the label was the only one in the policy.

Step two: Remove the label either thru the UI or with PowerShell

But expect! What does this mean for content that has the characterization applied? Nothing for the fourth dimension beingness… the label goes into a Awaiting Deletion state. Although for a fourth dimension, existing content will retain the retention label practical, it will eventually exist removed past a timer process running in the background. This process will clear the retention characterization from whatever content that had it applied. For testing I've washed, this procedure can take several hours to complete.

You can confirm this past doing aContent search in the Security & Compliance Center filtering on theCompliance tag and the label you're wanting to remove (image). (Reference: Where's my Office 365 Retention Label applied?)

By searching across All Locations, you can find out exactly where the label was practical. (Exchange email, SharePoint sites, OneDrive accounts, Office 365 groups)

ContentSearch

It may take several hours, but somewhen the timer process will clear the memory label from any content it was applied to and the search query volition return 0 results.


Scenario 4: Created a RECORD label

If yous've checked the box to allocate content tagged with characterization as a "Tape" (image), you will NOT be able to delete it in one case it's created. This holds true whether the characterization has been published in a retention policy or not OR applied to content or not.

Label classified as Record

If the record label was practical to content, this will prevent anything deemed as a record to have its label removed so deleting the label definition will not remove it from the content it'due south been applied to. Any rules were defined for the label will withal be adhered to. For case, if the content was to be declared a tape and so deleted later on seven years, it would exist. But the site drove ambassador can remove or modify a record characterization once it's practical which is how yous could remove/modify the label if required.

The Delete label push is disabled:

DeleteRecordLabel

Trying to brute-force a delete thru PowerShell will not work either:

Removing a Record label with PowerShell

If you no longer wish to use the record label for new content, remove it from the retention policy(due south) it'southward published in. This will remove it from theUse label dropdown in the UI for end-users, however existing content with the label applied will remain intact.

Note: To my cognition, currently in that location is no way to delete a label once the record checkbox has been selected fifty-fifty if it hasn't been applied to any content.


My Recommendation

It'south important to understand where a retention label is being used beyond Office 365 locations BEFORE deleting it. The best way to do this is using the Content Search characteristic in the Security & Compliance Center.

Based on your retention requirements, you can either permit the Timer process to consummate and clear the retentiveness label you want deleted or, based on the search results, proactively apply a dissimilar characterization prior to deleting it.

Thanks for reading.

-JCK


Credit: Photo by Matija Mestrovic on Unsplash

floreslartudied.blogspot.com

Source: https://joannecklein.com/2018/07/02/deleting-an-office-365-retention-label/

0 Response to "How Do I Programmaticly Remove the Delete Button Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel