How to: Get a Previous Revision of a WorkItem
The full history of each WorkItem is saved in the WorkItemStore. When you change and save a WorkItem, you save the WorkItem as a new revision. You can get all previous revisions of a WorkItem by its revision number (which is a one-based integer) or by date and time (System.DateTime).
The following examples assume a WorkItemStore exists by the name of workItemStore.
Example
To get the first version of a WorkItem with the WorkItem ID:
WorkItem workItem1 = workItemStore.GetWorkItem(id, 1);
To get the WorkItem revision as of midnight on April 17th, 2006:
WorkItem workItem2 = workItemStore.GetWorkItem(id, new DateTime(2006, 4, 17));
To get the fifth revision of a WorkItem with the WorkItem URI:
WorkItem workItem3 = workItemStore.GetWorkItem(uri, 5);
To get the WorkItem revision as of midnight on June 30th, 2006:
WorkItem workItem4 = workItemStore.GetWorkItem(uri, new DateTime(2006, 6, 30));
See Also
Tasks
How to: Get WorkItems with a WIQL Query