We've moved to the "Single Team Project" way of working, and thus our different teams are split up into different areas (because that works for us).
Our URLs are http://tfsserver/ProjectA
, http://tfsserver//ProjectB
etc.. etc.. which auto populates the Area, and thus makes sure all the work items go into the correct place.
However, all our queries are very simple for each team. This has led us to have query folders which duplicate many of the queries, but scope down to single areas, to make sure that query only targets the right work items.
Is there a @CurrentTeam macro which we can apply to our queries to prevent duplicating all our queries?
We can't be the only people with this problem can we - or we're doing it wrong.
No, there's no such thing right now in TFS. The only predefined macros are: @project
, @me
and @today
. You can create your own macros when using TFS object model for running queries but there's no way to do it in the UI.
Sample code:
var tpc = new TfsTeamProjectCollection(new Uri("http://localhost:8080/tfs/DefaultCollection"));
var store = tpc.GetService<WorkItemStore>();
Query query = new Query(store, "select * from workitems where System.AreaPath = @TeamArea", new Dictionary<string, string>() { { "TeamArea", "<Team area path>" } });
query.RunQuery();