是否可以在 TFS SDK 中查询工作项自定义字段 [英] is it possible to query workitem custom field in TFS SDK

查看:22
本文介绍了是否可以在 TFS SDK 中查询工作项自定义字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个工作项包含名为参考 ID"的自定义字段是否可以在此自定义字段上使用 wiql 进行查询.目前我正在使用以下方法:

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:

//TFS中的foreach项目

//foreach project in TFS

//形成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"]=必填值

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

//在这个工作项上做一些任务

//do some tasks on this workitem

这种方法需要相当长的时间,因为有 1000 多个结果.

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

推荐答案

是的.您使用与项目关联的字段名称.您可以使用 Process Explorer (

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');

这篇关于是否可以在 TFS SDK 中查询工作项自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆