I have this code that outputs the results to a textbox
try
{
// Connect to the work item store
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("xxx"));
WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
// Run a query.
WorkItemCollection queryResults = workItemStore.Query(richTextBox1.Text);
foreach (WorkItem workItem in queryResults)
{
richTextBox2.Text = string.Join(Environment.NewLine, workItem.AreaPath, workItem.Project);
}
}
catch (Exception exceptionmessage)
{
MessageBox.Show(exceptionmessage.ToString());
}
}
Can I treat the query result as I would a SQL query from SQL Server and bind it to a datagrid or dataviewer? I can't seem to get this to work, I don't understand how the data is handled and returned from WIQL/TFS.
No, you need to get the query result and place them into a table in a dataset, and then bind the dataset to datagrid. Refer to this article for details: http://blogs.msdn.com/b/briancombs/archive/2006/09/19/762210.aspx