Delete items from Preservation hold library in SharePoint online
Hi All,
I was struggle for few days to remove/delete content from preservation hold library in SharePoint Online. If you check online or ask Bing chat engine(Chat GPT), you will get response at the end of the page but actually it doesn’t help, still I have shared those details as they are needed to be followed to make sure we don’t have any hold from Admin center.
You need to make sure you follow below steps in addition to release all holds from admin center which are not documented in any article I could find.
$SiteURL = "https://customersite.sharepoint.com/sites/site"
$ListName = "Preservation Hold Library"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Delete all files from the library
Get-PnPList -Identity $ListName | Get-PnPListItem -PageSize 100 -ScriptBlock {
Param($items) Invoke-PnPQuery } | ForEach-Object { $_.Recycle() | Out-Null
}
Get-PnPListItem : This library contains items that have been modified or deleted but must remain
available due to eDiscovery holds. Items cannot be modified or removed.
At line:8 char:35
To remove hold on the Preservation, hold library in SharePoint Online, you can follow these steps:
- Go to Microsoft Purview Compliance Portal as a global admin.
- If you have any Retention Policies – Exclude the site from the retention policy.
- If you have eDiscovery cases – Close all eDiscovery cases.
- If you have Data loss prevention policies – Disable them.
To exclude a site from the retention policy in SharePoint Online, you can follow these steps:
- Go to Microsoft Purview Compliance Portal as a global admin
- Select “Exclude Sites”
- Enter the URL of the site that you want to exclude, and then select the plus (+) button
- Select the check box for the site. You can add other sites if you want
- After you enter all the sites that you want to exclude, select “Exclude” at the bottom of the window to confirm the changes
- Select “Save”