Krichie – That SharePoint Guy

February 18, 2007

Purging a SharePoint list of all items and folders

Filed under: Development, SharePoint — Keith Richie @ 11:09 pm

I saw a posting on

microsoft.public.sharepoint.development_and_programming

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.

HTH!

- Keith Richie

6 Comments »

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

    Comment by Andy — February 21, 2007 @ 6:16 pm

  2. I agree, that is another good method, but users stand the chance of accidentally deleting the forms folder too.

    Comment by Keith Richie — February 21, 2007 @ 9:19 pm

  3. [...] – That SharePoint Guy It’s a household name « Purging a SharePoint list of all items and folders Give us your thoughts on what you would like to see in DeliverPoint 2007! [...]

    Pingback by Importing/Exporting SharePoint Document Libraries to/from the File System « Krichie - That SharePoint Guy — March 7, 2007 @ 4:35 am

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

    Comment by Keith Richie — March 8, 2007 @ 3:54 am

  5. [...] Purging a SharePoint list of all items and folders [...]

    Pingback by SPPurgeList on CodePlex - Purging a SharePoint list of all items and folders « Krichie - That SharePoint Guy — March 8, 2007 @ 4:48 am

  6. debtfree for debtfree for

    Comment by debtfree states — February 16, 2008 @ 8:23 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.