Reputation: 1023
My Work Item table has some custom fields and i am trying to get these fields by querying with WorkItemCollection, like this:
WorkItemCollection queryResults = workItemStore.Query("Select [State], [Work Item Type], [Title], [Resource Development], [Microvix.Complexity.Development] FROM WorkItems " +
"WHERE [Work Item Type] = '" + tipoWorkItem + "' AND [State] <> 'Closed' AND [Team Project] = '" + teamProjectName + "'");
Next, i am looping the result, but i can't get the custom fields, like this:
foreach (WorkItem workItem in queryResults)
{
variable = workItem.Fields["Microvix.Resource.Development"].Value;
}
I Get an error that says the field does not exists.... I have tried with brackets, the "common" name, but nothing.
If a query an other common field like Title, State, it works fine.
I am sure that this field exists in Work Item table, because if a expand the queryResults -> DisplayFields -> Non-public members -> Items, my custom field is there.
I have also checked with TFS plugin from Visual Studio and everything seems to be ok.
Is there any other option to get custom fields from queries, or is there any other configuration to do with custom fields so they can be recognized correctly?
Upvotes: 2
Views: 1164
Reputation: 1023
It was a technical problem with TFS database, the fields were not beeing created for some reason.
They way i've done is working now.
Upvotes: -1