Get child work items for a specific parent in TFS

2019-07-23 00:17发布

问题:

How to get child work items for a specific parent in TFS? I need a Flat List which takes a parent ID as a query parameter and returns the child work items.

Note: Till now I'm able to to do this only with the 'Work Items and Direct Links' query.

回答1:

We cannot achieve that by "Flat list of work items" query as there ins't the fields/condition to query that, we can use "Tree of work items":

  1. Select "Tree of work items"
  2. Set up the query for the top level work items, "User Story" with id 105 for example here (See below screenshot, just specify the Parent work item ID here).
  3. Under "Filters for linked work items" you can exclude descendent items, or specify the Child work item types, for example only show Task and Bug, just set Work Item Type in Task,Bug, or leave it as [Any], it will returns all the types of child work items for the specific Parent.
  4. Filter options : Match top-level work items first, Type of tree : Parent/Child



回答2:

You can custom widget to get work items by using WorkItemTrackingHttpClient (e.g. queryById()), then display the result what you want.

About custom dashboard widget: Add a dashboard widget.

There are many extension samples that can help you: vsts-extension-samples



标签: tfs