STSADM Extensions Library Documentation

Overview

The STSADM Extensions Library was created for the following reasons:
  • Provide developers of custom STSADM commands with a jumpstart for creating their code.
  • Provide an open and extensible command definition and execution model

Command Definition

Using .NET attributes, the model provides a natural method of specifying command characteristics and behaviour. The following characteristics of a command are identified using attributes:
  • A command's name and help message are defined by the SPaCommandAttribute applied to the command template class. Example:
	[SPaCommand("listsiteinfo", HelpMessage="-url <site Url>")]
	public class MyCommands : ISPaCommandTemplate
  • Command parameters are defined using .NET properties in the command template class. A property is exposed as a parameter by decorating it with the SPaParameterAttribute.
        private string _URL;
        [SPExParameter("url", IsRequired=true, DisplayName="Site Url")]
        /// <summary>
        /// URL parameter
        /// </summary>
        public string URL
        {
            get { return _URL; }
            set { _URL = value; }
        }
  • Parameter-specific validation is supplied by a decorating a parameter property with a Validator attribute (ex. SPaUrlParameterValidator).
        private string _URL;
        [SPExParameter("url", IsRequired=true, DisplayName="Site Url")]
	[SPaUrlParameterValidator]
        /// <summary>
        /// URL parameter
        /// </summary>
        public string URL
        {
            get { return _URL; }
            set { _URL = value; }
        }


Click here for more Validator Attributes

Command Execution

A base implementation of the ISPStsadmCommand interface, SPaCommandInterpreter provides the following:
  • Encapsulate common command logic and isolate it from the core of the command execution. Some common logic the library provides:
  • Displays the command's help message
  • Parameter validation
    • Are parameter names input by the user valid for the command?
    • Is a required parameter specified?
    • Execute detailed, command-specific parameter validation

Getting Started

Option 1: Quick Start

  1. Download the Runtime Binary for latest release of SPaDevToolkit
  2. Follow the installation instructions included in the download.
  3. Create a custom command: HowTo: Create an STSADM Command

Option 2: Source Code

  1. Download the Source Code for latest release of SPaDevToolkit
  2. Follow the instructions in the zip file to:
    1. Compile the solution
    2. Deploy the assemblies
  3. Create a custom command: HowTo: Create an STSADM Command

Last edited Jul 18, 2008 at 12:07 AM by drudolph, version 5

Comments

No comments yet.