Remove a Document Library that used to contain records

When you use "declare record" in a SharePoint Online library it makes the library un-deletable.

Even if you undeclare all records and remove all the files the "remove library" setting will be unavailable from the document library settings page in the UI.

Luckily this is easily remidied with some PnP PowerShell

Connect-PnPOnline https://<tenant>.sharepoint.com -Credentials <credentials>
$list = Get-PnPList -Identity "<Offending Library>"
$list.AllowDeletion = $true
$list.Update()
Remove-PnPList $list -Force
Remove a Document Library that used to contain records
Share this

Subscribe to Cognit Dev Blog