1

是否可以使用 TFS API 从当前 TFS 上下文中获取 @Project、@Me 等默认参数?

var contextManager = GetService<ITeamFoundationContextManager>(); // from Team Explorer (VS Extension)
var tpc = contextManager.CurrentContext.TeamProjectCollection;
var workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
var project = workItemStore.Projects[teamProjectName];
var parameters = new Dictionary<string, string> { { "project", project.Name } }; // get them from context!?
var qry = project.QueryHierarchy.First(q => ...) as QueryDefinition;
var items = store.Query(qry, parameters);
4

1 回答 1

0

我已经看到,只有宏@Project、@Me 和@Today。@Project 是我必须手动设置的唯一一个,如问题中的代码所示。@Me 和 @Today 正在隐式工作。

于 2013-09-16T11:07:42.593 回答