TFS 2010 API获取工作项的所有状态
我想获取工作项的所有状态的列表。 我正在制作一个 UI,使用户能够查看特定项目的 TFS 中所有任务的状态。
为了做到这一点,我需要为项目可能处于的每种可能状态显示一列。
有什么方法可以使用 API 获取此信息吗? 如果不是,我想我会尝试这样的事情: TFS API - 有没有办法获取工作项类型的转换列表? 其中涉及查看 xml 来获取它们。
谢谢, 科汉
I would like to get a list of all the states for a work item.
I am making a UI that will enable users to see the state of all tasks in TFS for a specific project.
In order to do this i need to show a column for each of the possible states an item could be in.
Is there any way to get this information using the API?
If not i guess i will try something like this: TFS API - is there a way to get a list of the transitions for a workitem type? which involves looking at the xml to get them.
Thanks,
Kohan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想列出给定工作项类型的所有可能状态,您提到的链接是可行的方法。
API 不公开任何类型的状态列表。并且工作项规则引擎的某些部分是用本机代码编写的,因此如果您考虑走反射路线,则无法实现。
WorkItemType 类(这是查找转换的位置)在 Reflector 中打开时,会显示 PSWorkItemTypeClass 类型的私有字段,该字段又是规则引擎公开的本机对象的包装器(并且,正如人们可以想象的那样,它是一个黑匣子)。
另一方面,如果您想使用当前使用的所有状态填充 UI,则需要考虑的另一个选项是查询关系仓库。
连接到 Tfs_Warehouse 数据库并发出以下查询:
其中 My-Team-Project 是您的团队项目名称。
请考虑到事务存储(TFS 存储实际工作项)和关系数据仓库之间存在一些延迟。
The link you mentioned is the way to go, if one want to list ALL possible states for a given Work Item type.
The API does not expose any sort of States list. And portions of the Work Item Rule Engine are written in native code and thus are out of reach, in case you considered to go down the reflection route.
The WorkItemType class (which would be the place to look at to find the transitions), when opened up in Reflector, shows a private field of type PSWorkItemTypeClass, which in turn is a wrapper to the native object exposed by the Rule Engine (and, as one can imagine, it's a black box).
On the other hand, if you want to populate your UI with all the states currently in use, another option to consider would be to query the relational warehouse.
Connect to the Tfs_Warehouse database and issue the following query:
Where My-Team-Project is your team project name.
Take into account that there is some delay between the transactional store (where TFS stores the real work items) and the relational data warehouse.