Undo (or discard saved changes) WorkItem for old version in TFS API

I am looking to create an undo mechanism for a TFS work item using the TFS API - this will undo the changes made. Basically, after saving the new data (also using the API) in the work item, I would like the parameter to return the WorkItem back to the previous version.

Pseudo code is something like this ...

1) Get the current work item for Id: xxxxxx

2) Get the "revision id" of this last work item and save it to "PreviousRevId"

3) Change field values

4) Save

5) why we no longer want these changes (domain logic as for reasons excluded for brevity)

6) Revert to the old version ("PreviousRevId") and make it the current (latest) version

+3


source to share


3 answers


Have a look at the Visualizer Visual Studio I created. By accepting the work item ID, you can display the history of all work item fields.

http://geekswithblogs.net/TarunArora/archive/2011/08/21/tfs-sdk-work-item-history-visualizer-using-tfs-api.aspx



But it will help you get information, take a break, you will need to create your own control to create the returned functionality.

EDIT: It's also worth checking out this visual studio extension ** http://visualstudiogallery.msdn.microsoft.com/d127b275-b7b6-4504-b01e-58b4a010ff53 This allows you to see the work item as it was in historical date. Giving you the base effect affects you. NTN

+2


source


I don't think this can be achieved with the SDK, you can do it directly from the DB, but it is of course not recommended at all, anyway the main 2 tables for storing work items: WorkItemsWere and WorkItemsLates see this:



enter image description here

0


source


There is no automatic return, but it is a simple foreach loop to iterate over the fields to update them to the previous value. You also need to worry about links and attachments.

0


source







All Articles