Orphaned Parent Labels

Copper Contributor

Hello, 

 

When testing I created a label that was used as the default in a label policy. I have since used the same label as a parent label to multiple sublabels. The issue is I now have orphaned parent labels that have been applied to items. I would like to lift and shift all items labeled with a parent label to one of the sub labels. 

 

I have not found a good way to do this programmatically. 

 

For instance 100 Items labeled "Internal". 

 

Internal is now the parent label to "Internal - General", and "Internal - HR" Neither Parent label or Sub Labels have a protection template associated with them. However, when I run the PS against the Parent label to delete, I obviously cannot as it exists as a parent label. 

 

Is there a good way to grab the GUID for each and apply one of the newer sublabels so I no longer have orphaned labels?

3 Replies
If a File was already labeled with a standalone label it isn't a good idea to change it to a parent label.
You could use content explorer to find those files and relabel them manually.

There is also another thread on a similar topic
https://techcommunity.microsoft.com/t5/microsoft-365/apply-sensitivity-labels-using-powershell/m-p/2...

@folucian 

 

Thank you for the reply. I would not be moving an already labeled item from one parent label to another but from a parent label to a sublabel created under the parent label. I have written some PS to accomplish but so far I have been unable to complete the task programmatically. 

 

The parent label was used for testing and the sublabel was created under the parent label after testing was complete, so, I have 40k labeled documents with an orphaned label. Relabeling manually wouldnt really be an option. 

There are some similar discussions here
https://www.yammer.com/askipteam
You can join that community and ask how other did it using SDK.