Create List Items (aka EnumerationValues) In Bulk Using EnumCreator.xlsx
Published Feb 15 2019 02:10 AM 414 Views
First published on TECHNET on Feb 10, 2010

This blog post is intended for developers and people doing advanced customizations in Service Manager.


Not too long ago I shared a blog post called 'Understanding Lists/EnumerationValues: CI Status Example ’ which explained how you can make simple, quick modifications to lists using the main console and how you can add list items through Management Pack XML too. Sometimes these list taxonomies can be very large.  Creating each one of them one by one in the console could be pretty time consuming if you have tens or even 100+.


One of our Microsoft Consulting Services consultants, Tomaz Cebul, had a great idea for a list item creator tool in Excel.  He sent me a draft version of this to which I have added some things.  Thanks Tomaz!


This spreadsheet allows you to enter in list item display names.  Behind the scenes, some crazy Excel functions are building the management pack XML for you based on what you enter.  Then all you have to do is copy the Management Pack XML out of the spreadsheet, paste it into a .xml file and import it into Service Manager.


Here is how you use the tool:



  1. Enter the ID of your MP.  Alphanumeric characters only with no spaces.

  2. Enter the Version of your MP.  Unless you have some specific reason not to, I’d suggest using ‘1.0.0.0’.

  3. Enter the Name of your MP.  Alphanumeric characters only.  Spaces are allowed.

  4. Decide if you are going to extend an existing list or create an entirely new list.  If you are customizing something like Incident Classification as I did in this example, you are customizing an existing list.  If you are building a brand new solution or adding a new field which includes a new enum data type property then you are probably creating a new list.  If you are extending an existing list, you’ll need to enter a couple of pieces of information:


    1. The MP ID of the MP that contains the “root” Enumeration value you want to extend from.  Note: on the worksheet called ‘OutOfBoxEnums’ I provided a list of the MP ID and Enum ID of some of the lists you are most likely to want to customize.

    2. The MP Version of that MP.

    3. The MP Public Key Token of that MP.

  5. Now start to fill out the table with your list items.


    1. If you are extending from a root in another MP, enter the root enum ID in the first column.  Otherwise leave the first column blank.

    2. For each enum item, you need to enter a row of data.

  6. When you are done entering your enums, copy the MP XML and paste it into a file. Save the file as the same name as the MP ID + the .xml file extension.

Note: this tool only works for English.  If you need to localize the content into an additional language please see the blog post on Localizing Management Pack Content .


Note: you can extend more than one root in a single custom MP, but both roots must be in the same MP as in the example below.


Note: you can create up to 200 enum values per MP using this tool.  If you need more than that you can do it as two different MPs or if you have some knowledge of Excel you can probably figure out how to unprotect the worksheet and make the table a little larger.


Here are some screen shots of an example I did in the tool:




This results in a management pack that looks like this:


<ManagementPack  ContentReadable="true" SchemaVersion="1.1" OriginalSchemaVersion="1.1">


<Manifest>


<Identity>


<ID>MyCustomMP</ID>


<Version>1.0.0.0</Version>


</Identity>


<Name>My Custom MP</Name>


<References>


<Reference Alias="System.WorkItem.Incident.Library">


<ID>System.WorkItem.Incident.Library</ID>


<Version>7.0.5244.0</Version>


<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>


</Reference>


</References>


</Manifest>


<TypeDefinitions>


<EntityTypes>


<EnumerationTypes>


<EnumerationValue ID="CoffeeMachine.Enum" Accessibility="Public" Ordinal="0" Parent="System.WorkItem.Incident.Library!IncidentClassificationEnum"/>


<EnumerationValue ID="CoffeeMachine.Filters.Enum" Accessibility="Public" Ordinal="1" Parent="CoffeeMachine.Enum"/>


<EnumerationValue ID="CoffeeMachine.Drain.Enum" Accessibility="Public" Ordinal="2" Parent="CoffeeMachine.Enum"/>


<EnumerationValue ID="CoffeeMachine.Drain.Pipe.Enum" Accessibility="Public" Ordinal="3" Parent="CoffeeMachine.Drain.Enum"/>


<EnumerationValue ID="CoffeeMachine.Drain.Fitting.Enum" Accessibility="Public" Ordinal="4" Parent="CoffeeMachine.Drain.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.Enum" Accessibility="Public" Ordinal="5" Parent="CoffeeMachine.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.OutofCoffee.Enum" Accessibility="Public" Ordinal="6" Parent="CoffeeMachine.Coffee.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.CoffeeTastesBad.Enum" Accessibility="Public" Ordinal="7" Parent="CoffeeMachine.Coffee.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.CoffeeTastesBad.TastesWateredDown.Enum" Accessibility="Public" Ordinal="8" Parent="CoffeeMachine.Coffee.CoffeeTastesBad.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.CoffeeTastesBad.TooCold.Enum" Accessibility="Public" Ordinal="9" Parent="CoffeeMachine.Coffee.CoffeeTastesBad.Enum"/>


<EnumerationValue ID="CoffeeMachine.Coffee.CoffeeTastesBad.DoesntTasteLikeStarbucks.Enum" Accessibility="Public" Ordinal="10" Parent="CoffeeMachine.Coffee.CoffeeTastesBad.Enum"/>


<EnumerationValue ID="CalledCoffeeMachineRepairTechnician.Enum" Accessibility="Public" Ordinal="11" Parent="System.WorkItem.Incident.Library!IncidentResolutionCategoryEnum"/>


</EnumerationTypes>


</EntityTypes>


</TypeDefinitions>


<LanguagePacks>


<LanguagePack ID="ENU" IsDefault="true">


<DisplayStrings>


<DisplayString ElementID="CoffeeMachine.Enum">


<Name>Coffee Machine</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Filters.Enum">


<Name>Filters</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Drain.Enum">


<Name>Drain</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Drain.Pipe.Enum">


<Name>Pipe</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Drain.Fitting.Enum">


<Name>Fitting</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.Enum">


<Name>Coffee</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.OutofCoffee.Enum">


<Name>Out of Coffee</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.CoffeeTastesBad.Enum">


<Name>Coffee Tastes Bad</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.CoffeeTastesBad.TastesWateredDown.Enum">


<Name>Tastes Watered Down</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.CoffeeTastesBad.TooCold.Enum">


<Name>Too Cold</Name>


</DisplayString>


<DisplayString ElementID="CoffeeMachine.Coffee.CoffeeTastesBad.DoesntTasteLikeStarbucks.Enum">


<Name>Doesn’t Taste Like Starbucks&quot;</Name>


</DisplayString>


<DisplayString ElementID="CalledCoffeeMachineRepairTechnician.Enum">


<Name>Called Coffee Machine Repair Technician</Name>


</DisplayString>


<DisplayString ElementID="MyCustomMP">


<Name>My Custom MP</Name>


</DisplayString>


</DisplayStrings>


</LanguagePack>


</LanguagePacks>


</ManagementPack>


Which is then imported and displayed in the UI like this:




Once these are imported you can of course manage them in the main console Library/Lists view which will update the management pack.








You can get the tool from here:


http://cid-17faa48294add53f.skydrive.live.com/self.aspx/.Public/Tools/EnumCreator.xlsx


If you have any issues, suggestions, or other comments about the tool, please leave a comment.

Version history
Last update:
‎Mar 11 2019 08:22 AM
Updated by: