Get the history of the โ€œtextโ€ in the previous work item

Say I'm doing a work item in TFS. Then I make changes and update the text on the History tab (then save).

Using the TFS API, how can I get this text?

I would think that this would be in the "History" line for the last item in the "Revision" collection in the work item. (Because you can use the History in a regular work item to set the line through the API.) However, in the Revisions array, all work items are displayed with an empty history.

Any ideas on how I can get this line?

+7
source share
2 answers

Check this blog post: http://blogs.msdn.com/b/aaronbjork/archive/2011/01/10/programmatically-reading-work-item-comments.aspx

This is a simple operation, but at first it may not be entirely clear if you do not find that you need to iterate over the Revisions collection of the work item to view these comments.

+4
source

You can get any of the main tfs fields via aaronbjork and change it to use

Field f = r.Fields.TryGetById(1); or Field f = r.Fields["Title"]

  • title = 1
  • description = 52
  • the list of names and identifiers is in the CoreField enumeration (only for non-standard fields)
+1
source

All Articles