Partager via


How to Use Objects Passed to a Configuration Manager Form

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

In Microsoft System Center Configuration Manager 2007, you use the PropertyManager object to access objects that are selected in the Configuration Manager 2007 console.

Note

If no object is selected in the Configuration Manager console, an empty PropertyManager object is created and passed to the form. This can be used for creating new objects.

The form manages the serialization of objects in the PropertyManager object, and any changes you make are automatically saved when you click OK, or they are abandoned when you click Cancel.

Depending on the SelectionMode attribute of the action's ActionDescription element, more than one object can be passed to the PropertyManager object. Changes that you make by using the PropertyManager object are then applied to all objects that are passed in. If you want to access the individual objects, you must cast the PropertyManager object to a ResultObjectsManager. You then access the objects through the ResultObjectManager object collection.

For more information, see Configuration Manager Action XML.

For information about getting the property manager in a dialog box, see How to Create a Configuration Manager Dialog Box.

Displaying the Package Name

The following procedure demonstrates using a PropertyManager object to access a single object passed to a property sheet. Clicking a button displays a message box that contains the name of a selected package. To complete these steps, you must first perform the actions in the following topics:

To display the package name

  1. If the Configuration Manager console is open, close it.

  2. In Visual Studio 2005, open the project you created in How to Create a Configuration Manager Property Sheet.

  3. In Solution Explorer, right-click ConfigMgrControl.cs, and then click View Designer.

  4. In the Toolbox, click the Common Controls tab, and then double-click Button. A button named button1 is added to your control on the User Control Designer.

  5. In the User Control Designer, double-click button1 and type the following code in the button1_Click method source code that is displayed:

    DialogHelper.ShowMessageBox(string.Format("The {0} package was selected", PropertyManager["Name"].StringValue));
    
  6. Build the project and copy the assembly to the %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin folder.

  7. Open the Configuration Manager console, and navigate to the Packages node under Software Distribution.

  8. Right-click a package, and then click Show my Property Sheet. The dialog box is displayed.

  9. Click the button, and the name of the package is displayed in the dialog box.

See Also

Concepts

About Configuration Manager Console Forms
How to Bind Configuration Manager Data to a Form