So you’ve created an awesome application that uses the TFS SDK to do all kinds of amazing and interesting data access, but it sure would be nice if you could click on a work item and open it in Team Web Access. You’d think this would be easily accomplished by appending “id=123” to the end of a query string. It’s not quite that straightforward, but the TFS SDK makes it pretty simple.
Here’s what you need to do:
- Add the appropriate TFS SDK references
- Instantiate a TfsTeamProjectCollection
- Retrieve the hyperlink service from the team project collection object
- Retrieve the hyperlink from the hyperlink service by providing a work item ID
Here’s what the code will look like:
var tpc = new TfsTeamProjectCollection( new Uri("http://OurTfsServer:8080/tfs/OurCollection")); var linkService = tpc.GetService(); var uri = linkService.GetWorkItemEditorUrl(workItemId);
2 thoughts on “Get Work Item Hyperlinks from the TFS SDK”
var tfs = SetupTFSClient();
var linkservice = tfs.GetService();
var uri = linkservice.GetWorkItemEditorUrl(workitemId);
hello the above didn’t work. this seems to have worked for me.
var linkService = tfs.GetService();