Project Description
A simple template Visual Studio project that can be used as a starting place for creating your own custom SharePoint 2007 STSADM extensions. The project includes utlities and classes to help declare and work with parameters as well as build a WSP solution to deploy your new extensions. The project is based on the work found here: http://stsadm.blogspot.com/

General Usage
The template project includes a sample command that you can use as a starting place for creating your own command: "MyCommand". You can either work with this starter command or rename it to a more appropriate name to meet your needs. Your commands should inherit from SPOperation. SPOperation is an abstract class and implements the ISPStsadmCommand interface. In your constructor you create a new SPParamCollection object and then add new SPParam objects to it. You then call Init() passing in the SPParamCollection object and a help message. using the SPParam objects essentially allows you to describe the parameters that you will use for your command as well as any basic validation - existing validators can be found in the SPValidators directory. If you need additional validation then override the Validate() method and add your additional validation before the call to the base class. In your Run() command simply call InitParameters() and pass in the keyValues (StringDictionary) object. From there you're ready to start building out your command.

I've included some initial code to help get an SPWeb object instance based on a passed in url. I've also included some utility methods in the Utilities class. One of these methods, RunStsAdmOperation, can be used to make a call out to another stsadm command from your command - this can be useful when you wish to wrap one or more commands.

Last edited Mar 7, 2008 at 1:24 AM by glapointe, version 3