Fetching the comment history for a work item in TFS

旧时模样 提交于 2019-12-06 01:02:40

问题


In most defect trackers there is a comment history associated with a ticket/incident/issue/work item.

I wish to get this same information from TFS via the SDK for a work item - ideally:

  • Who created the comment.
  • The text of the comment.
  • Who last updated/edited the comment (if that's event possible in TFS?)

I have determined that a WorkItem has a collection of revisions availabe via the "Revisions" property, and that you can loop through each revision - but a revision does not have a "History" property where I assume I could find the comment created by the user. Also I don't believe it's compulsory to record a comment with each change - so I suspect I will need to ignore revisions that don't have any history property information?

Revisions Property on MSDN

Any thoughts on the best way to fetch this "comment history" information for a work item in TFS - is the revisions list the correct way, or should I be using some other part of the API?


回答1:


In order to fetch the comment history you need to access the "History" property on the Work Item revision.

WorkItem.History Property

Obviously the current (latest) version of the work item will have this field as empty, but historical revision comments will be there.

TFS: Getting workitem history from the api

The "History" displayed on a work item in Team Explorer is built by looping through the Revissions and displaying both the fields that were changed and the text in the "History" property



来源:https://stackoverflow.com/questions/3508000/fetching-the-comment-history-for-a-work-item-in-tfs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!