积极答复者
TFS如何实现多项目交叉管理?

问题
答案
-
Hi
据我所知你需要使用TFS API去得到某个User在一个Team Project Collection中所有的work items:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.WorkItemTracking.Client; namespace Model.versionControl { public static class GetAllWorkItems { public static void GetWorkItems() { NetworkCredential cre = new NetworkCredential("userName", "password", "domain"); TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://TFSServerName:8080/tfs/CollectionName"), cre); WorkItemStore wis = tfs.GetService<WorkItemStore>(); WorkItemCollection workItems = null; string WorkItemType = "WorkItemType"; string AssignedTo = "userName"; workItems = wis.Query(string.Format("SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems where [System.WorkItemType]={0} and [System.AssignedTo]={1}"),WorkItemType,AssignedTo); foreach (WorkItem item in workItems) { Console.WriteLine(item.Id+item.Title); } } } }
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 Vicky SongMicrosoft employee, Moderator 2012年5月7日 7:22
全部回复
-
Hi
据我所知你需要使用TFS API去得到某个User在一个Team Project Collection中所有的work items:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.WorkItemTracking.Client; namespace Model.versionControl { public static class GetAllWorkItems { public static void GetWorkItems() { NetworkCredential cre = new NetworkCredential("userName", "password", "domain"); TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://TFSServerName:8080/tfs/CollectionName"), cre); WorkItemStore wis = tfs.GetService<WorkItemStore>(); WorkItemCollection workItems = null; string WorkItemType = "WorkItemType"; string AssignedTo = "userName"; workItems = wis.Query(string.Format("SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems where [System.WorkItemType]={0} and [System.AssignedTo]={1}"),WorkItemType,AssignedTo); foreach (WorkItem item in workItems) { Console.WriteLine(item.Id+item.Title); } } } }
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 Vicky SongMicrosoft employee, Moderator 2012年5月7日 7:22