0
votes

We are using TFS 2012 with a SCRUM Template. We have 9 custom columns in our Product backlog board in TFS 2012. How do I get the Column name for each Product Backlog Item using the TFS API libraries?

eg.

WorkItemCollection wic = workItemStore.Query(wiql);
foreach (WorkItem wi in wic)
{
    //This is not the right property, only values such as New, Committed, Done.
    var notColumnName = field.State; 
}

The Columns

Our column names do not align to the State value when I view "Customize Columns" therefore I can't use the value of WorkItem.State. I'm unsure if this is correct or not, it was setup by our architect to work this way and that's what we have.

1

1 Answers

0
votes

Not sure if the values you listed are field names or possible states of the PBI. To get the value of any field, you can use this:

var fieldValue = wi.Fields["System.State"].Value;
fieldValue = wi.State;

If these are field names you can use the name instead the reference name for it:

Field assigned = wi.Fields.["Assigned To"]; //works
Field storyChange = wi.Fields.["Story Change"];

You can check the WorkItemTypeDefinition if you are not sure about the names or reference names.