I am trying to query workitem info from TFS – specifically from the CMMI Risk template. It looks like no matter what I put in the select clause, I still actually need to look in the Fields collection for the value. With this query:
WorkItemCollection queryResults = workItemStore.Query(@"
SELECT [System.Id],
[System.WorkItemType],
[System.Title],
[Microsoft.VSTS.Common.Severity],
[Microsoft.VSTS.CMMI.Probability]
FROM WorkItems
WHERE [System.TeamProject] = 'MyProj'
and [System.WorkItemType] = 'Risk'
ORDER BY [System.Id] ");
I cannot see
queryResults[0].Severity or
queryResults[0].Probability
in the output, but I can see
queryResults[0].Fields["Severity"];
Seems the select list is irrelevant in this case. What am I missing?
Only for a few fields properties are created (I believe it are the system fields). For all other fields you need to access it as you described.
So you are not missing anything.