Monday, February 22, 2016

Traversing TFS Links

Recently, Team Foundation Server (TFS) has added some new features that my team is using. One of these features is the new Epic work item. We are using epics to track high-level business initiatives, with features underneath the epics to track user requirements. Underneath the features, we have user stories, which are self-contained units of work that can be tested and deployed independently. My team works with user stories and tracks everything through user stories. I need to drive my reporting by user stories but relate the data to the epics that they are under.

The built-in reporting capabilities of TFS are pretty good, but they don't handle the kind of roll-up reporting I need. A consultant friend shared some code snippets with me that use the TFS API to pull data from the TFS database. I'm building out my custom reporting using the TFS API. One of the first challenges I've run into is starting with a user story and determining the epic that contains that story.

I struggled trying to understand how to follow the links that are available on a TFS WorkItem object. This link pushed my understanding forward quickly. It helped me understand how to identify the "type" of link that I was seeing.

"The tricky bit" for me is identifying the type of link I'm dealing with. Here is the code snippet to do that:

if (link.LinkTypeEnd.Name == "Parent")
In this code snippet, I am filtering on links that are of type "Parent." One could easily filter on other types of links based on need.

As I develop my TFS reporting capability, I will document what I'm doing to make it less mysterious for others.

No comments:

Post a Comment