Forum Discussion

Gurdev Singh's avatar
Gurdev Singh
Iron Contributor
Jul 18, 2023

Deleting a large SharePoint library with retention labels applied to content

Are there any clever methods known to anyone for deleting a large SharePoint library that has retention label applied to all its content? I understand we will have to individually delete each item to empty out all folders before any folder and ultimately the library can be removed. Any other ideas?

    • Gurdev Singh's avatar
      Gurdev Singh
      Iron Contributor
      Thanks Juan. PowerShell is our course of action using the Remove-PnPListItem cmdlet. It is going to take few hours and I guess my post was to find out if there is any simpler or faster way but it appears there is not.
      • Gurdev Singh's avatar
        Gurdev Singh
        Iron Contributor

        Adding more details...We ultimately decided to use the retention and disposal labels to accomplish this. Given the root cause behind library unable to be deleted is a long term retention label, deleting items using script was moving these to PreservationHoldLibrary where these will remain for a very long time.

        As the data is duplicate and redundant, we have decided to create a new retention label to delete content after 2 days from creation date. This label will be applied to all items in library, making the built-in SharePoint function to then get rid of it for us.

Resources