次の方法で共有


How to Create Folder Items

Applies To: System Center 2012 - Service Manager

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

A folder item always appears in a folder and presents a single view. A folder item cannot be created without a parent folder. The parent folder can be the workspace folder or any folder inside the workspace. Folder items can use other public management pack folders as parent folders. This enables you extend the console structure of another management pack. A task can be associated with a folder item. To do this, associate the task with the view that the folder item targets.

To create a folder item

  1. Create or get reference to an existing ManagementPackView object.

  2. Create or get reference to an existing ManagementPackFolder object.

  3. Create an instance of the ManagementPackFolderItem class. Specify the unique identifier of the folder item, the view this folder item will present, and the folder that will host it.

  4. Call the AcceptChanges method on the management pack of the ManagementPackFolder object instance used by the folder item.

Example

The following example creates two folder items which point to two separate views. Both folder items are contained in the same parent folder:

EnterpriseManagementGroup mg = new EnterpriseManagementGroup("localhost");
ManagementPack mp = new ManagementPack("Folder\\RePackaging.Library.xml", mg);

ManagementPackFolder folder = mp.GetFolder("Folder.Packaging.Requests");
ManagementPackView viewNew = mp.GetView("Views.Packaging.Requests.New");
ManagementPackView viewAll = mp.GetView("Views.Packaging.Requests.All");
ManagementPackFolderItem itemNew = new ManagementPackFolderItem("FolderItem.Packaging.Requests.New", viewNew, folder);
ManagementPackFolderItem itemAll = new ManagementPackFolderItem("FolderItem.Packaging.Requests.All", viewAll, folder);

itemNew.Name = "New";
itemAll.Name = "All";

mp.AcceptChanges();

Compiling the Code

Namespaces

Microsoft.EnterpriseManagement

Microsoft.EnterpriseManagement.Configuration

Assemblies

Microsoft.EnterpriseManagement.Core

See Also

Tasks

How to Create Folders

Other Resources

Scenario: Working with the Console