How to: Get a WorkItem
Each WorkItem is uniquely identified by ID (a positive integer) and Artifact URI. To get a WorkItem, provide GetWorkItem with the ID or URI of the WorkItem.
The following examples assume a WorkItemStore exists by the name of workItemStore.
Example
To retrieve a WorkItem by ID:
WorkItem workItem1 = workItemStore.GetWorkItem(id);
WorkItem workItem2 = workItemStore.GetWorkItem(15407);
To retrieve a WorkItem by URI:
WorkItem workItem3 = workItemStore.GetWorkItem(uri);
WorkItem workItem4 = workItemStore.GetWorkItem("vstfs:///WorkItemTracking/WorkItem/15407");
See Also
Tasks
How to: Get a Previous Revision of a WorkItem
How to: Get WorkItems with a WIQL Query