Purging a SharePoint list of all items and folders

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”

  1. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: