Tuesday, February 1, 2011

Delete a Corrupted List Using STSADM

If you have a list that might appear to be in a corrupted state, when you try to delete it using SharePoint Web UI you will get the following error message:

Invalid file name.
The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file.<nativehr>0x81020030</nativehr><nativestack></nativestack>

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid file name.
The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file.<nativehr>0x81020030</nativehr><nativestack></nativestack>

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

By using STSADM operation’s forcedeletelist, you can delete the corrupted list, here is the syntax:

stsadm -o forcedeletelist -url <URL>

Example:

stsadm –o forcedeletelist –url http://sharepointserver/lists/yourcorruptedlist

2 comments:

Matthew Lamb said...

We had a problem where the Site Content and Structure view would not open, giving the error "An unexpected error has occured". By increasing the verbosity of the ULS logs and looking up the Correlation ID we were able to find the GUID of the list which was causing the problem. I then looked up this GUID in the Content Database's "AllLists" table (column tp_ID) to determine which list was the problem.

The lists were corrupted but could not be deleted using the above technique. This was returning the useless error message
"<nativehr>0x80070002</nativehr><nativestack></nativestack>"

We also tried deleting the lists using PowerShell but this returned an error saying "List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user."

Finally we found that the list had previously been deleted and was already appearing in the Recycle Bin, but for some reason was also appearing in its original place in the SharePoint site.

So we deleted the item from the Site-collection level "Deleted from end user Recycle Bin" view, and the list then disappeared, and the Site Content and Structure view started working again.

Hope this might help someone!

Salaudeen Rajack said...

We can delete corrupted lists using PowerShell as well:

Force Delete Corrupted SharePoint List using PowerShell / STSADM