Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to query workitem custom field in TFS SDK

Tags:

tfs

I have few workitems which contain custom field called "Reference ID" is it possible to query using wiql on this custom field. Currently I am using the following approach:

//foreach project in TFS

//form the wiql

WorkItemCollection workItemCollection = workItemStore.Query(
                    " SELECT [System.Id], [System.WorkItemType]," +
                    " [System.State], [System.AssignedTo], [System.Title] " +
                    " FROM WorkItems " +
                    " WHERE [System.TeamProject] = '" + tfsProject.Name +
                    "' ORDER BY [System.WorkItemType], [System.Id]");

//run a loop against the result set

//if workitem.Fields["Reference ID"]=required value

//do some tasks on this workitem

this approach is taking quite sometime since there are more than 1000 results.

my question: is it possible to add custom field also as a filter condition in the above query

like image 558
balalakshmi Avatar asked Sep 11 '25 04:09

balalakshmi


1 Answers

Yes. You use the field name that's associated with the item. You can get this using the Process Explorer (TFS Power Tools) and opening the WorkItemType.

Here's an example we use today

Select Id from WorkItems where ([xxx.Ticket.OriginalTicketID] = '12345');
like image 103
Robaticus Avatar answered Sep 13 '25 10:09

Robaticus