Partager via


New MP Enumeration List

There seems to be little information on the Internet about creating new lists which you can use a drop down in Service Manager. Sure you can type each value into a simple list when creating a request offering or add values to an existing list – but what about creating a complete new list. For this it is best to use a plain old XML editor and just plug in the values you want. Let’s look at this – first I create a new management pack using the authoring tool. My daughter is an avid Karate student so I’ll create the belt ranks in a list, this can be added to a user object.

First we create a new class to hold our list – open up the authoring console and create a new management pack. Right click on the classes and select create a new configuration item class – give it a name, mine was KarateRanks. Right click on the new class and select View class. Delete the inserted property at the bottom and ignore all warnings.

image

Now we create a new property which will be the list of ranks. Click on Create Property and give it a name – change the Key property to True.

image

At the moment this is just a string – we want it to hold a list. Scroll up the property details window and click on the Data Type property – change it to list. For me there is a slight delay but a list prompt will pop up eventually.

image

Click on Create List and give it a new name – this is the internal name for the list. Click create when done.

image

The new list is now created – however to add objects to it and then use them later on we need to seal the management pack. Instructions for sealing a management pack can be found at https://technet.microsoft.com/en-us/library/hh495605.aspx . After this is complete I can import my sealed management pack into Service Manager – my list will appear in the Library –> Lists section of the console and I can add items to it. The first time you create an item you will be prompted to store the values in an unsealed management pack – for a custom list I would usually create a new MP to hold the values. A benefit of this is once you have something stored in there you can export the MP and use a text editor to add values to it instead of adding them through the console. Note: You have to replace the ID with a new value in the text file.

image

Ok so now I have my ranks stored in a list in Service Manager – I need to extend my class which I’m going to add the property to. Because this list is contained in it’s own class as opposed to an extension of a class I can attach it to any object I want. For the example I’m going to extend the Active Directory user class and allow a rank to be added to that.

In the authoring tool create another new management pack. In the class browser find the Active Directory User class and right click and select View. This will add it to the Management Pack explorer window. Right click on the class and select Extend class. When prompted save the extension in the new management pack. Change the default name to something more descriptive.

image

Click on Create Property and give it a name – right click on the created property and select details. We need to tell this property that it is a list – so change the data type dropdown to List. A chooser box will open and you can select your new list from there.

image

image

All done! Once I save and Import the management pack into Service Manager I can check a user object and see my new attribute is available.

image

In a future post I will customise the User form and add a new tab so the information is easier to find.