[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The management pack defines all aspects of your solution. It contains all the key components of the solution and also their configuration. A management group contains two types of management packs, core-system management packs and user-defined management packs. While a complex management pack is mostly going to be written in XML and imported into the Service Manager data store, the following example shows how to create a management pack through code. Creating a new management pack is as simple as creating an instance of the ManagementPack class and providing the EnterpriseManagementGroup object. Inevitably, your management pack will have to reference something from the core management packs, and providing the management group on the management pack constructor enables this to occur if it is required. Referencing other management packs lets you use the functionality they provide and Service Manager provides management packs that are specific to the product and those that are generic enough that can be used by your solutions.

Note
These examples only define a management pack; they do not install it.

To create the management pack

  1. Create a connection to the server by using the EnterpriseManagementGroup object.

  2. Define the name, friendly name, and version of the management pack.

  3. Create the ManagementPack instance.

C#  Copy Code
EnterpriseManagementGroup mg = new EnterpriseManagementGroup("localhost");

string mpName = "RePackaging.Library";
string mpFriendlyName = "RePackaging Library";
Version mpVersion = new Version(1, 0);

ManagementPack mp = new ManagementPack(mpName, mpFriendlyName, mpVersion, mg);

Namespaces

Microsoft.EnterpriseManagement

Microsoft.EnterpriseManagement.Configuration

Assemblies

Microsoft.EnterpriseManagement.Core

To create a class on the management pack

  1. Find the existing WorkItem management pack from Service Manager.

  2. Create a new class that has the WorkItem class as its base.

    Tip
    If you create a class on a new management pack and have accepted the changes to it, you still have to install the management pack for it to appear in the system.If you create the class on an existing management pack, you only have to accept the changes to the management pack to see the new class in the system.
  3. Allow the management pack to accept the changes.

The following example creates a new class using the WorkItem class as the base class.

C#  Copy Code
EnterpriseManagementGroup mg = new EnterpriseManagementGroup("localhost");
ManagementPack workItemMP = mg.ManagementPacks.GetManagementPack("System.WorkItem.Library", "9396306c2be7fcc4", new Version());

ManagementPack mp = new ManagementPack("RePackaging.Library", "RePackaging Library", new Version(1, 0), mg);
ManagementPackClass mpClass = new ManagementPackClass(mp, "RePackaging.Request", ManagementPackAccessibility.Public);

mpClass.Base = workItemMP.GetClass("System.WorkItem");

mp.AcceptChanges();

Namespaces

Microsoft.EnterpriseManagement

Microsoft.EnterpriseManagement.Configuration

Assemblies

Microsoft.EnterpriseManagement.Core