Forum Discussion
Gurdev Singh
Jul 18, 2023Iron Contributor
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...
Jul 19, 2023
Hi,
What about writing a Script / Code that does the job?
What about writing a Script / Code that does the job?
- Gurdev SinghJul 20, 2023Iron ContributorThanks 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 SinghJul 20, 2023Iron 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.- BarbarurJul 21, 2023Brass Contributor
Deleting the Retention Label and the Policy used to publish it would have remove the label from every single file automatically. Then you could delete the library.