Udostępnij za pośrednictwem


How to Create a Configuration Manager Property Sheet

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

To create a Configuration Manager 2007 console property sheet, in Microsoft System Center Configuration Manager 2007, you create a .NET Framework assembly that inherits from the following classes:

Class Description

SmsPageControl

The control displayed on the property page.

SmsPropertyPage

Starts the control in a property page. It is called by the Configuration Manager console, which uses it to create a property sheet with the property page.

The following procedures show you how to create a Configuration Manager property sheet assembly by using Visual Studio. The property sheet displays a property page that contains a button. When it is clicked, the button displays the name of a package selected in the Configuration Manager console Packages node.

After you have successfully built the dialog box assembly, you must do the following to integrate it into the Configuration Manager console:

  1. Define and deploy the form XML that links the selected action to the assembly you create in this topic. For more information, see How to Create Form XML for a Configuration Manager Property Sheet.

  2. Define and deploy the action XML for displaying the context menu that the user selects. For more information, see How to Create Action XML for a Configuration Manager Property Sheet.

When you have created the dialog box assembly and XML, right-click a package in the Configuration Manager console tree Packages node results pane, and select the menu item Show my Property Sheet. A property sheet is displayed. You can enhance the control by accessing the package that was selected in the Configuration Manager console. For more information, see How to Use Objects Passed to a Configuration Manager Form.

Create the Control Class

The following procedure creates the control for the property sheet.

To create the Visual Studio project

  1. In Visual Studio 2005, on the File menu, point to New, and then click Project to open the New Project dialog box.

  2. From the list of Visual C#, Windows projects, select the Windows Control Library project template, and then type ConfigMgrControl in the Name box.

  3. Click OK to create the Visual Studio project.

  4. In Solution Explorer, right-click UserControl1.cs, click Rename, and then change the name to ConfigMgrControl.cs.

  5. In Solution Explorer, right-click References and then click Add Reference.

  6. In the Add Reference dialog box, click the Browse tab, navigate to %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin and then select microsoft.configurationmanagement.dll, and microsoft.configurationmanagement.managementprovider.dll Microsoft.ManagementConsole.dll. Click OK to add the assemblies as project references. If you do not find Microsoft.ManagementConsole.dll, add it from %Windir%\System32.

  7. In Solution Explorer, right-click ConfigMgrControl.cs, and then click View Code.

  8. In the source code, change the namespace to Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet

  9. Change the class ConfigMgrControl so that it derives from SmsPageControl.

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

  11. In the source code, change the namespace to Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet

  12. Change the class ConfigMgrControl so that it derives from SmsPageControl.

  13. In ConfigMgrControl.cs, Add the following new constructor to the ConfigMgrControl class:

    public ConfigMgrControl(SmsPageData pageData) : base(pageData)
    {
        InitializeComponent();
    }
    
  14. Add the following method to initialize the control:

    public override void InitializePageControl()
    {
       base.InitializePageControl();
    }
    

Create a Property Page Class

The following procedure creates the code that loads the control into a property page.

To add a property page class

  • In ConfigMgrControl.cs, add the following new class in the Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet namespace:

    public class ConfigMgrControlPage :SmsPropertyPage
    {
        public ConfigMgrControlPage(Guid sessionToken, SmsPageData pageData)
            : base(sessionToken, pageData)
        {
            this.Title = "ConfigMgrDialog";
            pageData.ParentControl = this;
            this.Control = new ConfigMgrControl(pageData);
        }
    }
    

Deploy the Assembly

The following procedure builds and copies the assembly that you have created to the Configuration Manager console assemblies folder. For important information about deploying Configuration Manager console extensions, see Configuration Manager Console Extension Deployment.

To deploy the dialog box assembly

  1. Build the project. The assembly should be created as \Visual Studio 2005\Projects\ConfigMgrControl\ConfigMgrControl\bin\Debug\ConfigMgrControl.dll.

  2. Copy the assembly to the folder %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin.

See Also

Concepts

How to Add a Property Page to an Existing Configuration Manager Property Sheet
How to Create Action XML for a Configuration Manager Property Sheet
How to Create Form XML for a Configuration Manager Property Sheet
How to Use Objects Passed to a Configuration Manager Form