Delete a sharepoint 2010 document library using stsadm command?

1.8k views Asked by At

I am deploying a sharepoint 2010 custom document library template as a solution file and activating it to my site. When i am deleting the solution and deactivating the feature i also want to delete the libraries that were created from this template with all its contents. I have an uninstaller.bat file that performs the deactivation, i want to include the library removal script with the uninstaller. Is it possible to remove the libraries through stsasdm command?

2

There are 2 answers

0
Rich Bennema On BEST ANSWER

You can use Forcedeletelist, but you will need to know the URLs of the libraries you want to delete. Note, despite the name, this command will not delete the list if AllowDeletion is set to false.

Two things to consider:

  1. In SharePoint 2010, stsadm has been deprecated in favor of PowerShell.
  2. To me, it would make more sense to perform this operation in the FeatureDeactivating method of a Feature Receiver instead of in a script.
1
Mark Mascolino On

You could write a Feature Receiver http://msdn.microsoft.com/en-us/library/ms469501.aspx that runs when the Feature is deactivated that will take care of the deletes for you.