Deletion files/folders with retention labels in a specific SharePoint Online site

%3CLINGO-SUB%20id%3D%22lingo-sub-1523558%22%20slang%3D%22en-US%22%3EDeletion%20files%20with%20retention%20labels%20in%20specific%20SharePoint%20Online%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1523558%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EI%20have%20been%20asked%20to%20delete%20few%20folders%20with%20old%20files%2C%20which%20doubles%20with%20same%20folders%20in%20other%20location.%20There%20are%20retention%20labels%20applied%20to%20the%20files.%3C%2FP%3E%3CP%3EI%20cannot%20delete%20those%20specific%20folders%20and%20subfolders%20because%20of%20the%20labels%20(although%20I%20do%20not%20receive%20any%20error%20messages)%2C%20as%20SP%20admin%20and%20I%20had%20to%20remove%20the%20label%20on%20file%20by%20file%20basis...%3C%2FP%3E%3CP%3EThis%20takes%20lots%20off%20effort%20and%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20question%20is%20-%20%3CSTRONG%3EIs%20there%20a%20way%20(GUI%20or%20PowerShell)%20to%20remove%20or%20change%20the%20labels%20to%20'None'%20in%20specific%20SP%20library%20or%20folder%20(and%20subfolders)%3C%2FSTRONG%3E%20so%20they%20can%20be%20deleted%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20do%20not%20want%20to%20change%2Fdelete%2Fremove%20labels%20for%20the%20whole%20tenant%20-%20but%20just%20on%20library%2Ffolder%2Fsubfolder%20level.%3C%2FP%3E%3CP%3EAll%20I%20can%20see%20is%20either%20remove%20or%20add%20labels%20in%20Compliance%20centre%20for%20the%20whole%20M365%20and%20tenant..%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1523936%22%20slang%3D%22en-US%22%3ERe%3A%20Deletion%20files%2Ffolders%20with%20retention%20labels%20in%20a%20specific%20SharePoint%20Online%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1523936%22%20slang%3D%22en-US%22%3E%3CP%3EYou'll%20need%20to%20remove%20the%20label%20from%20those%20items%20first%2C%20this%20is%20done%20on%20each%20item%20individually%2C%20not%20via%20the%20SCC.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1524090%22%20slang%3D%22en-US%22%3ERe%3A%20Deletion%20files%2Ffolders%20with%20retention%20labels%20in%20a%20specific%20SharePoint%20Online%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1524090%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3B-%20thanks%20for%20fast%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20was%20part%20of%20my%20question%20-%20how%20to%20remove%20them%3F%3C%2FP%3E%3CP%3EI%20mean%20easily%3F%20I%20was%20going%20to%20each%20subfolder%20and%20selecting%20each%20file(s)%20and%20setting%20the%20Labels%20to%20'None'.%3C%2FP%3E%3CP%3EBut%20this%20requires%20lots%20of%20that%20action%20as%20there%20are%20lots%20of%20subfolders%20and%20subfolders%20etc.%3C%2FP%3E%3CP%3EIs%20there%20a%20Powershell%20I%20can%20use%20to%20select%20the%20url%20-%20i.e.%20%3CA%20href%3D%22https%3A%2F%2Ftenant.com%2Fsites%2Fmysite%2FDocuments%2Ffolder%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.com%2Fsites%2Fmysite%2FDocuments%2Ffolder%2F%3C%2FA%3E%26nbsp%3Band%20the%20run%20a%20command%20towards%20that%20folder%20to%20set%20labels%20on%20all%20items%20within%20it%20to%20a%20label%20'None'%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20select%20the%20folder%20and%20set%20the%20label%20to%20'None'%2C%20then%20the%20files%20in%20the%20subfolders%20retain%20the%20label%20and%20does%20not%20allow%20me%20to%20delete..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20not%20much%20on%20that%20topic%20on%20internet%2C%20i'm%20surprised...%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ERoumen%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1528502%22%20slang%3D%22en-US%22%3ERe%3A%20Deletion%20files%2Ffolders%20with%20retention%20labels%20in%20a%20specific%20SharePoint%20Online%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1528502%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F384191%22%20target%3D%22_blank%22%3E%40RSWork%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20the%20labels%20have%20not%20been%20set%20individually%20on%20files%20then%20you%20can%20change%20the%20label%20at%20the%20highest%20folder%20you%20want%20to%20delete%20and%20the%20label%20will%20cascade.%20I%20haven't%20yet%20had%20to%20remove%20labels%20via%20powershell%20sorry.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20your%20case%20it%20may%20either%20take%20a%20bit%20of%20time%20to%20update%20or%20the%20labels%20have%20been%20set%20individually.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi All,

I have been asked to delete few folders with old files, which doubles with same folders in other location. There are retention labels applied to the files.

I cannot delete those specific folders and subfolders because of the labels (although I do not receive any error messages), as SP admin and I had to change the labels to 'None' on file by file basis and then delete...This takes lots off effort and time as I have lots to do.

 

My question is - Is there a way (GUI or PowerShell) to remove or change the labels to 'None' in specific SP library or folder (and subfolders) so they can be deleted?

 

I do not want to change/delete/remove labels for the whole tenant - but just on library/folder/subfolder level.

All I can see is either remove or add labels in Compliance centre for the whole M365 and tenant..

Thanks in advance!

 

3 Replies

You'll need to remove the label from those items first, this is done on each item individually, not via the SCC.

Hi @Vasil Michev - thanks for fast reply.

 

That was part of my question - how to remove them?

I mean easily? I was going to each subfolder and selecting each file(s) and setting the Labels to 'None'.

But this requires lots of that action as there are lots of subfolders and subfolders etc.

Is there a Powershell I can use to select the url - i.e. https://tenant.com/sites/mysite/Documents/folder/ and the run a command towards that folder to set labels on all items within it to a label 'None'?

 

If I select the folder and set the label to 'None', then the files in the subfolders retain the label and does not allow me to delete..

 

There is not much on that topic on internet, i'm surprised...

Regards,

Roumen

Hi @RSWork ,

 

If the labels have not been set individually on files then you can change the label at the highest folder you want to delete and the label will cascade. I haven't yet had to remove labels via powershell sorry. 

 

In your case it may either take a bit of time to update or the labels have been set individually.