【发布时间】:2014-05-14 14:10:58
【问题描述】:
我的待办事项中有一个带有自定义列的板。有什么方法可以在特定列中获取所有用户故事?
我有两个具有相同状态“活动”的列,因此我无法按状态过滤,我需要按列名进行过滤。例如,我需要在“A”列(状态为活动)中获取“用户故事”而不返回“B”列(也为活动)中的“用户故事”。
更新:该程序不在安装了 TFS 的同一台计算机上运行。我需要在客户端执行此操作。
public class Program
{
static void Main(string[] args)
{
Uri collectionUri = new Uri("http://tfs-server/tfs");
TfsConfigurationServer configurationServer =
TfsConfigurationServerFactory.GetConfigurationServer(collectionUri);
ReadOnlyCollection<CatalogNode> collectionNodes = configurationServer.CatalogNode.QueryChildren(
new[] { CatalogResourceTypes.ProjectCollection },
false,
CatalogQueryOptions.None);
Guid collectionId = new Guid(collectionNodes[0].Resource.Properties["InstanceId"]);
TfsTeamProjectCollection teamProjectCollection = configurationServer.GetTeamProjectCollection(collectionId);
var workStore = teamProjectCollection.GetService<WorkItemStore>();
var storiesInA = workStore.Query(
@" Select [State], [Title] From WorkItems
Where
[Work Item Type] = 'User Story' and
[State] = 'Active' and
[System.AreaPath] = 'MyPath'
Order By [State] Asc, [Changed Date] Desc");
}
}
【问题讨论】:
标签: c# visual-studio tfs