获取某些 WorkItem 的必填字段 [英] Get required fields for some WorkItem

查看:33
本文介绍了获取某些 WorkItem 的必填字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 TFS API 或其他工具获取此类 XML?此 XML 包含有关必须在翻译工作项中填写到另一个状态的字段的信息.

Is it possible to get such XML, using TFS API or other tools? This XML contains information about the fields that must be filled in translation work item to another status.

在这里屏幕http://sqlrefactorstudio.com/content/png/TFS%20Work%20item%20required%20fields.png

推荐答案

在下面的简单示例中使用 TFS API 将写出给定工作项的必填字段.

Using the TFS API in the simple example below will write out the required fields for a given work item.

    /// <summary>
    /// Writes out the required fields for a work item.
    /// </summary>
    /// <param name="workItemId">The ID of a work item.</param>
    private static void _GetRequiredFieldsForWorkItem(int workItemId)
    {
        using (TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false, new UICredentialsProvider()))
        {
            if (tpp.ShowDialog() == DialogResult.OK)
            {
                TfsTeamProjectCollection projectCollection = tpp.SelectedTeamProjectCollection;
                WorkItemStore store = projectCollection.GetService<WorkItemStore>();

                Console.WriteLine("Required Work Item Fields");
                Console.WriteLine("-------------------------------");

                WorkItem item = store.GetWorkItem(workItemId);
                foreach (Field field in item.Fields)
                {
                    if (field.IsRequired)
                    {
                        Console.WriteLine(field.ReferenceName);
                    }
                }
            }
        }
    }

这篇关于获取某些 WorkItem 的必填字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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