Reputation: 95
I have PowerShell code that exports my Bug and Test Cases WIT's into a folder, but I want to add new data to the XML. So I would want to add a new version number each time but not remove any of the existing data e.g. Next version is 1.1.0.2205. I already have the code to import the WIT but this is where I am struggling. Any help would be much appreciated
Here is how the Bug WIT looks like and where I want to add the data:
<FIELD name="Detected in Version" refname="Example.DetectedInVersion" type="String" reportable="dimension">
<SUGGESTEDVALUES expanditems="true">
<LISTITEM value="1.2107.0.0" />
<LISTITEM value="1.2201.0.0" />
<LISTITEM value="1.1.0.2202" />
<LISTITEM value="1.1.0.2203" />
<LISTITEM value="1.1.0.2204" />
</SUGGESTEDVALUES>
<REQUIRED />
</FIELD>
Upvotes: 0
Views: 150
Reputation: 8343
I would avoid changing the WIT every type, use a GlobalList instead. Your definition becomes
<FIELD name="Detected in Version" refname="Example.DetectedInVersion" type="String" reportable="dimension">
<SUGGESTEDVALUES expanditems="true">
<GLOBALLIST name="MyListOfVersions" />
</SUGGESTEDVALUES>
<REQUIRED />
</FIELD>
the global list is defined in another XML file like this
<?xml version="1.0" encoding="utf-8"?>
<gl:GLOBALLISTS xmlns:gl="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/globallists">
<GLOBALLIST name="MyListOfVersions">
<LISTITEM value="1.2107.0.0" />
<LISTITEM value="1.2201.0.0" />
<LISTITEM value="1.1.0.2202" />
<LISTITEM value="1.1.0.2203" />
<LISTITEM value="1.1.0.2204" />
</GLOBALLIST>
</gl:GLOBALLISTS>
and imported using a command like
witadmin importgloballist /collection:http://your_tfs_server:8080/tfs/DefaultCollection /f:MyListOfVersionsGlobalLists.xml
Now it is easy to edit this list without changing the definition. You can re-run the same command altering the file's content, or, if you prefer pure Powershell code, look at Adding to a GlobalList
Upvotes: 2