Created
February 1, 2012 14:00
-
-
Save joergbattermann/1717049 to your computer and use it in GitHub Desktop.
Open TFS WorkItem within a running Visual Studio instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static DocumentService _workItemDocumentService; | |
private static void OpenWorkItem(TeamFoundationServer tfsServer, int workItemId) | |
{ | |
if(_workItemDocumentService == null) | |
_workItemDocumentService = (DocumentService)DTE2.DTE.GetObject("Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.DocumentService"); | |
// you can also use _workItemDocumentService = (DocumentService)Package.GetGlobalService(typeof(DocumentService)); | |
IWorkItemDocument workItemDocument = workItemDocumentService.GetWorkItem(activeTFS, workItemId, this); | |
try | |
{ | |
if (!workItemDocument.IsLoaded) | |
workItemDocument.Load(); | |
workItemDocumentService.ShowWorkItem(workItemDocument); | |
} | |
finally | |
{ | |
workItemDocument.Release(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment