I saw a posting on
requesting this, so I thought I would share here as well in case anyone needed this functionality.
The code contained in this file: SPPurgeList.txt , contains sample code to purge a list of all it’s contents and folders (Define WSSV3 for that).
(Update 03-07-2007: See this link as this SPIEFolder is now published at http://www.codeplex.com/SPPurgeList )
If you need to retain the list itself (Maintaining it’s original GUID) without killing the entire list and re-creating, you can use this code to purge the list contents.
It should work on any list or document library. When I get a chance to really run it through the ringer, I may post it on my CodePlex site.
– Keith Richie
6 Replies to “Purging a SharePoint list of all items and folders”
Another way of clearing a large library – WebDAV. Just Select All and delete, as per normal in Explorer. It’s not rapid, but it works.
I agree, that is another good method, but users stand the chance of accidentally deleting the forms folder too.
Update, I have “Seen” the forms folder be deleted in Web Folders for V2 before, but it looks like a recent change to WebDAV is now preventing it. At one time, it would actually delete all the contents of the Forms folder, then stop at the end with “Cannot delete the forms folder”, but by then, all your contents were gone. Looks like that was finally fixed.
debtfree for debtfree for