다음을 통해 공유


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.

https://itfreesupport.com/wp-content/uploads/2023/04/Perhold1.jpg1. Open Office 365 Admin center and select the help option on right bottom corner of the screen.
2. Then on this window search for ‘Unable to delete SharePoint site’https://itfreesupport.com/wp-content/uploads/2023/04/Perhold2.jpg3. Once done, you should get option to run diagnostics on the SharePoint site, provide the URL and select ‘Run tests’https://itfreesupport.com/wp-content/uploads/2023/04/Perhold3.jpg4. The test will take few mins and once completed, you will see the hold has been removed from SharePoint sitehttps://itfreesupport.com/wp-content/uploads/2023/04/Perhold4.jpghttps://itfreesupport.com/wp-content/uploads/2023/04/Perhold5-1.jpg5. Now you can run below command and make sure all the files are deleted from the ‘Preservation Hold Library’

$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
}

https://itfreesupport.com/wp-content/uploads/2023/04/Perhold6.jpgIn past I use to run the same PowerShell but got error ‘This library contains items that have been modified or deleted but must remain available due to eDiscovery holds. Items cannot be modified or removed’ I followed below but they didn’t help.
 
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.

https://itfreesupport.com/wp-content/uploads/2023/04/Perhold7.jpghttps://itfreesupport.com/wp-content/uploads/2023/04/Perhold8.jpg

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”