sharepointscriptingsharepoint-2010stsadm

Delete a sharepoint 2010 document library using stsadm command?


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?


Solution

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