共用方式為


Configuration Manager AssemblyType Action

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

The AssemblyType action defines the type and assembly for a method that is called by the Configuration Manager 2007 console.

Note

The XML and C# code in this topic is available in the Dialog Prototype sample in the Configuration Manager SDK.

The following attributes and elements are specific to an action that calls a method in an assembly:

  • The Class attribute of the ActionDescription element is set to AssemblyType.

  • The ActionAssembly element has a number of child elements that are used to define the method and assembly.

  • The Assembly element identifies the assembly that contains the method. If the assembly is in a folder other than %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin folder then the Assembly element should include the assembly filename and the full path to the file.

  • The Type element contains the namespace and class for the method.

  • The Method element contains the name of the method to be called.

Method

The method signature is:

public static void Method(object, ScopeNode, ActionDescription, IResultObject, PropertyDataUpdated, Status)

Where the parameters are as follows:

  • object

    • The object calling the method.
  • ScopeNode
    The Configuration Manager console node that was active when the action was called
  • ActionDescription
    The ActionDescription class instance that initiated the action.
  • IResultObject
    The selected object, or null if there is no selected object.
  • PropertyDataUpdated
    The delegate to open to provide update information for the Configuration Manager console view.

Example Implementation

The following is an example implementation of the method.

public static void Method(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject resultObject, PropertyDataUpdated dataUpdatedDelegate, Status status)
{
    if (resultObject != null)
    {
        DialogHelper.ShowMessageBox(string.Format("The {0} package was selected", resultObject["Name"].StringValue));
    }
    else
    {
        DialogHelper.ShowMessageBox("No package was selected");
    }
}

AssemblyType Action XML

The following XML example demonstrates how to call a method, Method, in a class, SampleClass. The method is in the assembly AdminUI.PrototypeDialog.dll.

<ActionDescription Class="AssemblyType" DisplayName="Test Action (method)" MnemonicDisplayName="Mnemonic" Description="Description">
      <ActionAssembly>            <Assembly>AdminUI.PrototypeDialog.dll</Assembly>         <Type>Microsoft.ConfigurationManagement.AdminConsole.PrototypeDialog.ExampleClass</Type>        <Method>Method</Method>      </ActionAssembly>
</ActionDescription>

See Also

Concepts

How to Create a Configuration Manager Action
Configuration Manager Actions
Configuration Manager Action XML
How to Find a Configuration Manager Console Node GUID