質問

Is it possible to get the default parameters like @Project, @Me, ... from the current TFS context with the TFS API?

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);
役に立ちましたか?

解決

I've seen, that there are only the macros @Project, @Me and @Today. @Project is the only one of them I had to set manually like shown in my code in the question. @Me and @Today are working implicitly.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top