Let’s Fix “SharePoint List Cannot Be Deleted While on Hold or Retention Policy” Error

Mack John ~ Published: February 19th, 2025 ~ SharePoint ~ 6 Minutes Reading

While deleting a SharePoint list or document library, sometimes the “SharePoint list cannot be deleted while on hold or retention policy” issue occurs. It can be daunting if it occurs several times while you are performing a crucial task.

In SharePoint, whenever the data gets deleted then it is stored in the recycle bin. Along with that, a copy is also sent to the Preservation Hold Library. Due to this, to delete the SharePoint list, you need to delete all files and subfolders first. Which becomes confusing and complex for administrators. But don’t fret now you will never face this issue again. In this detailed guide, we will discuss the complete process of resolving this issue.

sharepoint list cannot be deleted while on hold or retention policy

But before directly jumping to the solution, let’s have a look at the user’s query posted on the Microsoft forum.

User’s Query:- I am trying to delete the SharePoint list with 10k+ items. Everything is fine in my SharePoint account but still, I am facing deletion issues that show the SharePoint list cannot be deleted while on hold.

This is just one user query although many users are asking for the same on different platforms.

Why You are Unable to Delete the List While it on Hold?

There are several reasons behind this error. Let’s take a look at them.

  1. Retention Policy Enforcement – SharePoint’s built-in feature of retention policy ensures the lists or libraries under a retention policy cannot be deleted. It preserves the content for the defined retention duration, even if the list is no longer used.
  2. Legal Hold or eDiscovery Hold – If a SharePoint site or a list is subject to a legal hold for some legal requirements, deletion of content is restricted in these cases.
  3. Compliance Settings – Microsoft Purview Compliance Center settings also may enforce preservation and restrict to deletion of content associated with sensitive data.
  4. Administrative Restrictions – The administrator can also add restrictions to prevent the data from being deleted.

How to Check if Your SharePoint Site is Under Hold?

You can follow the below steps to check if your SharePoint site is under hold.

  • Open the SharePoint Settings.
  • Now move to the Site Contents.
  • Verify if there is a Preservation Hold Library.

If you have found it under the Hold, then move to the next section to resolve the SharePoint list cannot be deleted while on hold.

How to Delete Document Library in Retention Hold Using PnP PowerShell?

If your document library is under hold and you are unable to delete it. Then you can use the below PowerShell commands. It will delete the files and subfolders first and then delete the document library.

#Parameters
$URL_of_Site = "Enter complete Site URL”
$Name_of_the_list = "SalesDepartment"

Connect-PnPOnline -URL $URL_of_Site -Credentials (Get-Credential)

$Web = Get-PnPWeb
$List = Get-PnPList -Identity $Name_of_the_list

Function Empty-PnPFolder([Microsoft.SharePoint.Client.Folder]$Folder)
{
If($Folder.Context.web.ServerRelativeURL -eq "/")
{
$Folders_Site_Relative_URL = $Folder.ServerRelativeUrl
}
Else
{
$Folders_Site_Relative_URL = $Folder.ServerRelativeUrl.Replace($Folder.Context.web.ServerRelativeURL,[string]::Empty)
}

$Files = Get-PnPFolderItem -FolderSiteRelativeUrl $Folders_Site_Relative_URL -ItemType File
ForEach ($File in $Files)
{
Remove-PnPFile -ServerRelativeUrl $File.ServerRelativeURL -Force -Recycle

}
$Sub_Folders = Get-PnPFolderItem -FolderSiteRelativeUrl $Folders_Site_Relative_URL -ItemType Folder
Foreach($Sub_Folder in $Sub_Folders)
{
If( ($Sub_Folder.Name -ne "Forms") -and (-Not($Sub_Folder.Name.StartsWith("_"))))
{

Empty-PnPFolder -Folder $Sub_Folder
$Parent_Folder_URL = $Folders_Site_Relative_URL.TrimStart("/")
Remove-PnPFolder -Name $Sub_Folder.Name -Folder $Parent_Folder_URL -Force -Recycle
Write-Host -f Green ("Deleted Folder: '{0}' at '{1}'" -f $Sub_Folder.Name, $Sub_Folder.ServerRelativeURL)
}
}
}
Empty-PnPFolder -Folder $List.RootFolder
Remove-PnPList -Identity $Name_of_the_list -Recycle -Force

PnP Batch Method to Resolve SharePoint List Cannot Be Deleted While on Hold

Check another script to clear the files first and then the document library.

$SP_Site_URL = "Provide the Complete Site URL"
$List_Name = "Marketing"

Try {
Connect-PnPOnline -Url $SP_Site_URL -Interactive
$SP_List = Get-PnPList $List_Name
$Item_Counter = $SP_List.ItemCount
If($Item_Counter -eq 0) { Write-host "Document Library is Already Empty!" -f Yellow; Break}

$global:count = 0
$ListItems = Get-PnPListItem -List $List_Name -PageSize 500 -Fields ID -ScriptBlock { Param($items) $global:count += $items.Count; Write-Progress -PercentComplete `
($global:Count / $Item_Counter * 100) -Activity "Getting Items from List" -Status "Getting Items $global:Count of $($Item_Counter)"}
Write-Progress -Activity "Completely Getting SharePoint List Items)" -Completed

$Sorted_Items = $ListItems | Select-Object @{Name="ServerRelativeURL";Expression={$_.FieldValues.FileRef}}, ID | Sort-Object -Descending -Property ServerRelativeURL

$Batch = New-PnPBatch
ForEach ($Item in $Sorted_Items)
{
Remove-PnPListItem -List $List_Name -Identity $Item.ID -Recycle -Batch $Batch

}
Invoke-PnPBatch -Batch $Batch -Details

Write-host -f Green "All of the Items in the Document Library has been deleted Successfully!"
}
Catch {
write-host "Error Found”
}

Using the above PowerShell commands you can resolve the SharePoint list deletion issues because of the hold or retention library . But do not forget to backup SharePoint Online to local storage before going to delete it. Because there might be further requirements to access the data. If you are managing another tenant or going to use, then you can migrate SharePoint site to another site using the SharePoint Migration Software.

Conclusion

In this detailed write-up, we have explained the mostly searched query SharePoint list cannot be deleted while on hold or retention policy. Now you do not need to search the same query again. Also, do not forget to store the list items before deletion.

Frequently Asked Questions

Q1. How do I check if my site is under Hold?

A – You can verify your site whether is under hold or not before going to delete the SharePoint list. Open your SharePoint site settings and then go to the site contents. Search for the Preservation hold library, if it exists. Then your site is under hold.  

Q2. Why I am unable to delete the SharePoint list while it is on hold?

A – There might be several reasons behind this issue such as:

  1. Retention policy enforcement.
  2. Legal hold or eDiscovery hold.
  3. Compliance settings.
  4. Administrative Restrictions

Q3. What are the reasons behind the deletion issues of the SharePoint list while it is on hold?

A – There are several reasons for the issues that arise when deleting the hold list. Let’s check out the major ones.

  1. Retention Policy Settings.
  2. Hold List of Legalities.
  3. Compliance Settings.
  4. Admin Restrictions.

Q4. Is there any way to delete the SharePoint list while it is on hold or restrict to delete due to the retention policy?

A – Yes, you can delete the SharePoint list even when it is on hold using the PowerShell commands. But make sure you have the required technical expertise to run the PowerShell commands. Also, do not forget to backup list or library to avoid data loss.