Reputation: 754
I'm trying to run this query and it keeps throwing a TF51005 The query references a field that does not exist. Caused by the [Microsoft.VSTS.Common.Severity], I don't know how i'm suppose to pull the severity
select [System.Id], [System.WorkItemType],[Microsoft.VSTS.Common.Severity]
from WorkItems
I'm using a console application with this code
foreach (WorkItem workItem in queryResults)
{
Console.WriteLine("ID: {0}", workItem.Id);
Console.WriteLine("Title: {0}", workItem.Title);
Console.WriteLine("State: {0}", workItem.State);
Console.WriteLine("Reason: {0}", workItem.Reason);
}
And I realized even if i can pull the column Severity isn't listed as a workitem property. Is it not possible to pull this data?
Upvotes: 0
Views: 696
Reputation: 12668
At least one of your work item types in the collection needs to include the Severity field, and probably doesn't.
You can run witadmin listfields to find all the fields that your collection uses.
Upvotes: 2
Reputation: 58980
The query is probably failing because that field is only present some work item types. Specifically, it's present on the Bug, Issue, and Risk work items, depending on your process template selection.
Restrict your query accordingly and it should be fine.
Work items can contain any number of fields, as defined by the process template. The work item object in the TFS API has properties that correspond to the fields that absolutely exist on every work item.
You can access the actual fields by inspecting the Fields
property on the work item object.
Upvotes: 2