开发者

How to query sub work items in TFS2010 using .NET

I created a task in TFS2010 and then created four tasks as child to the first task. I want to get all tasks that are child of give开发者_如何转开发n task in .NET, any idea what the query will be or how to code that?

Thanks.


Here how you can query sub task

public void GetSubWorkItems()
{
    var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://TFS:8080/TFS/DefaultCollection"));
    var workItemStore = tfs.GetService<WorkItemStore>();

    var wiqlQuery = String.Format(@"Select [State], [Title] From WorkItemLinks Where ([Source].[System.WorkItemType] = 'Task') Order By [State] Asc, [Changed Date] Desc"); ;

    var query = new Query(workItemStore, wiqlQuery);

    var workItems = query.RunLinkQuery();

    foreach (WorkItemLinkInfo workItemlink in workItems)
    {
        Console.WriteLine(workItemlink.SourceId);
    }
}

Thanks

M.Radwan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜