TFS API get full path (folder) of each workitem in assembly

  • 1 Replies
  • 960 Views
TFS API get full path (folder) of each workitem in assembly
« on: April 21, 2016, 12:07:51 pm »
I have a WorkItemCollection of work items (test cases). I am trying to find the path of each work item via .net code (TFS API). The folder / subfolder for each item in the solution-assembly tree. Is it possible to get? is it stored somewhere within each item's object ?

*

Oren

  • **
  • 59
Re: TFS API get full path (folder) of each workitem in assembly
« Reply #1 on: April 21, 2016, 17:55:29 pm »
I don't think it's possible to get that data from the item object.

But you could map each test case to it's relevant hierarchy by setting the default area of each work item with its respective path.

Alternatively, you could give each work item different tags representing your path, and then retrieve those tags via TFS API code.

Code
 public static string[] GetTagsForWorkItem(Uri tfsUri, int workItemId) 
        {
            // get a reference to the team project collection
            using (var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri))
            {
                // get a reference to the work item tracking service
                var workItemStore = projectCollection.GetService<WorkItemStore>();

                // and get the work item
                var wi = workItemStore.GetWorkItem(workItemId);
                return wi.Tags.Split(';');
            }
        }
« Last Edit: April 21, 2016, 17:57:21 pm by Oren »

 

Sitemap 1 2 3 4 5 6 7 8