ISPStsadmCommand.GetHelpMessage Method

Gets a remark about the syntax of the specified custom operation. This method is deprecated and may not be supported in future releases of . For custom command line operations, see the Microsoft.SharePoint.PowerShell namespace.

Namespace:  Microsoft.SharePoint.StsAdmin
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Function GetHelpMessage ( _
    command As String _
) As String
'Usage
Dim instance As ISPStsadmCommand
Dim command As String
Dim returnValue As String

returnValue = instance.GetHelpMessage(command)
string GetHelpMessage(
    string command
)

Parameters

  • command
    Type: System.String

    The operation about which help is sought.

Return Value

Type: System.String
A String that represents a description of the syntax of the operation command.

Remarks

Warning

This method is documented only to provide assistance in troubleshooting existing extensions of STSADM.EXE. Do not create new extensions. Instead, extend PowerShell. See the Microsoft.SharePoint.PowerShell namespace.

GetHelpMessage is called when the user enters the following at the system prompt, where myOperation is the name of your custom operation.

stsadm -help myOperation

The help message is streamed to the console.

GetHelpMessage is also called when Run returns SyntaxError().

The String that is returned is usually the only syntax help available to users of the command operation. So include everything that they needs to know, including the possible parameters, if any, that can be used with the operation.

Use standard syntax guidance style.

  • Use "[" and "]" to indicate material that is optional.

  • Use "{" and "}" to indicate material that is required.

  • When more than one parameter can be used, use "|" to separate the alternatives.

  • Variables should be enclosed in "<" and ">".

The following string is automatically prepended to the return value; do not set it explicitly.

"stsadm -o command \n"

The command is the name of your custom operation.

The following, for example, is the message returned by stsadm -help activatefeature. Note the use of indentation to improve readability.

stsadm -o activatefeature
       {-filename <relative path to Feature.xml> |
        -name <feature folder> |
        -id <feature Id>}
       [-url <url>]
       [-force]

Examples

The following example shows an implementation of GetHelpMessage for a simple operation that takes a parameter named "url". Note that because the custom class in this example creates only one new operation, the method does not need to read the command parameter. If more than one new operation were being defined, the method would need a structure that branched according to the value of command.

using System;
using System.Collections.Specialized;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.StsAdmin;

namespace MS.Samples.SharePoint
{
    public class SimpleCommandHandler : ISPStsadmCommand
    {
        public string GetHelpMessage(string command)
        {
            // "stsadm -o command \n" is prepended here.
            return "-url <full url to a site in SharePoint>";
        }

    // Run() implementation not shown.

    }
}
Imports System 
Imports System.Collections.Specialized 
Imports System.Text 
Imports Microsoft.SharePoint 
Imports Microsoft.SharePoint.StsAdmin 

Namespace MS.Samples.SharePoint 
    Public Class SimpleCommandHandler 
        Implements ISPStsadmCommand 
        Public Function GetHelpMessage(ByVal command As String) As String 
            ' "stsadm -o command \n" is prepended here. 
            Return "-url <full url to a site in SharePoint>" 
        End Function 
        
        ' Run() implementation not shown. 
        
    End Class 
End Namespace 

See Also

Reference

ISPStsadmCommand Interface

ISPStsadmCommand Members

Microsoft.SharePoint.StsAdmin Namespace

Other Resources

How to: Extend the STSADM Utility

Stsadm.exe command-line tool (Office SharePoint Server)