I've moved my blog to!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Monday, November 5, 2007

Delete a List Using "forcedeletelist"

I've noticed a lot of people looking for a way to delete a list (based on search terms used to hit my blog). There's a built in command called "forcedeletelist" which will do the trick. Note that there's a bug with the help message for the command:

C:\>stsadm -help forcedeletelist

stsadm.exe -o forcedeleteweb
           -url <url>

Notice above that it says "forcedeleteweb" - have no fear though - it won't delete your web - it's just a typo in the help text. I'm not sure why they called it forcedeletelist instead of just deletelist - if you disassemble the command though you'll see that it's calling an internal method called ForceDeleteList on the SPWeb object - this in turn calls ForceDeleteList on the unmanaged SPRequestInternalClass object. If you're looking for other list related operations check out these postings: Import, Export, and Copy Lists and Import, Export, Copy, and Delete List Items.

1 comment:

Anonymous said...

I have 2 lists that were apparently created by the publishing feature at some point, but a user apparently got in there and half deleted things, created another round of publishing feature created lists, and half deleted them as well. Now Content deployments fail if i include this level. I cannot delete the lists regardless of what I do. To further complicate things, the folders have been renamed. Effectively I have Images2 and Images3 visible (there are others, but if I figure out a way to get rid of any, I imagine to be able to get rid of all). Neither will accept deletion.

stsadm - o forcedeletelist -url leavingoutthehttps//portal/portalsite/site/subsiteLv1/subsiteLv2/subsiteLv3/subsiteLv4/subsiteLv5/folderinquestion

the response, after a brief pause is:

Value does not fall within the expected range.

Anyone got an idea how to beat this lil doozie out of SharePoint?