Configuration Manager AssemblyType Action

 

Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager

The AssemblyType action defines the type and assembly for a method that is called by the System Center 2012 R2 Configuration Manager 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\AdminConsole\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.

  • Status
    Allows control of the Configuration Manager console busy status indicator.

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) 
    {
        MessageBox.Show(string.Format("The {0} package was selected", resultObject["Name"].StringValue)); 
    }
    else
    {
        MessageBox.Show("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">
  <ShowOn>
    <string>DefaultHomeTab</string>
    <string>ContextMenu</string>
  </ShowOn>
  <ActionAssembly>
    <Assembly>AdminUI.PrototypeDialog.dll</Assembly>
    <Type>Microsoft.ConfigurationManagement.AdminConsole.PrototypeDialog.ExampleClass</Type>
    <Method>Method</Method>
    <!--Method signature: public static void Method(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject resultObject, PropertyDataUpdated dataUpdatedDelegate, Status status)--> 
  </ActionAssembly>
</ActionDescription>

See Also

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