访问工作项目的“看板"列(特定于团队的字段) [英] Access the Kanban Column (a Team-Specific Field) for a Work Item

查看:141
本文介绍了访问工作项目的“看板"列(特定于团队的字段)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用TFS 2012 API以编程方式访问WorkItem的看板列"?

Is there a way to programmatically access the "Kanban Column" for a WorkItem using the TFS 2012 API?

使用Scrum 2.2模板,每当将工作项拖到开发板上的看板列之间时,错误"或产品积压项目的历史记录就会将"[MyProject \ MyTeam]看板列"显示为已更改字段.通过TFS API专门检索工作项时可以访问.

Using the Scrum 2.2 template, the history of a Bug or Product Backlog Item shows "[MyProject\MyTeam] Kanban Column" as a changed field whenever a work item is dragged between Kanban columns on the Board, but the field is not accessible when specifically retrieving a work item through the TFS API.

Microsoft.TeamFoundation.Framework.Server.ISubscriber接口上实现ProcessEvent方法时,它还会在WorkItemChangedEvent对象中显示为更改的字段.

It also shows up as a changed field in the WorkItemChangedEvent object when implementing the ProcessEvent method on the Microsoft.TeamFoundation.Framework.Server.ISubscriber interface.

解决方法: 一位同事发现了博客文章关于创建一个只读的自定义字段,用于保留看板列的值,并利用WorkItemChangedEvent来捕获最新值.然后可以在此列上进行查询.这种方法的一个问题是只能跟踪一个团队的看板专栏".

Workaround: A coworker found a blogpost about creating a read-only custom field to persist the value of the Kanban Column, taking advantage of the WorkItemChangedEvent to capture the latest value. It is then possible to query on this column. One problem with this approach is that only a single team's Kanban Column can be tracked.

更新: 根据此博客文章 ,看板列"不是字段,而是"WIT扩展名".这可能有助于得出答案.

Update: According to this blogpost, the Kanban Column is not a field, rather a "WIT Extension". This may help lead to an answer.

推荐答案

我在ISubscriber.ProcessEvent方法内部找到了一种使用TFS 2013 API 读取值的方法:

I've found a way to read the value using the TFS 2013 API, inside the ISubscriber.ProcessEvent method:

var workItemId = 12345;
var extService = new WorkItemTypeExtensionService();
var workItemService = new WorkItemService();
var wit = workItemService.GetWorkItem(requestContext, workItemId);
foreach (var wef in extService.GetExtensions(requestContext, wit.WorkItemTypeExtensionIds))
{
    foreach (var field in wef.Fields)
    {
        if (field.LocalName == "Kanban Column" || field.LocalName == "Backlog items Column")
        {
            // Access the new column name
            var columnName = wit.LatestData[field.Field.FieldId];
        }
    }
}

这篇关于访问工作项目的“看板"列(特定于团队的字段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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