In the previous posts “TFS API Part 45 (VS11) – Modify Teams and Team Members” I talked about Teams, from getting all team to modify and creating new Team using TFS API.
Now, Teams are more than just a “Security Group”, they hold specific settings such as relevant Areas/Iteration for that Team.
The “Team” can be assigned to Backlog Iteration (Set as Team’s backlog Iteration), this takes all paths under that iteration and add them to the team backlog. You can also change the Iteration backlog to another path (not just the root), you just need at least one child below.


And from TFS 11 you can define Start Date and End Date for Iterations, and there is a cool fact – those dates are not just for beauty – TFS takes those iterations and automatically show you what is the current Iteration that you working on, what iterations you completed (past) and what iterations are next. you might have overlap iterations but for some reason you can only have one “Current” iteration.
The “Current” iteration is defined by the iteration for which the start date is less than or equal to today’s date and the end date is greater than or equal to today and than is just sorted by Name.
After you define the Iterations for the Project and for each Team you might want to define the Areas for the Team, you can also define a Default Area – Means that each work item you open under that Team.
When you define “Area\s” for Team this means that when you enter your Product Backlog (not query) you will only see work items under that “Area” (you choose if to include sub-areas)

Now, after we understand what and why let’s talk about How using TFS API.

Download Demo Project
Step 1: Create Project and Add Reference
Create an WPF application and add the following references:
First add reference for:
- Microsoft.TeamFoundation.Build.Client (11.0.0.0)
- Microsoft.TeamFoundation.Build.Common.dll (11.0.0.0)
- System.Windows.Forms.dll
(C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0\)
Step 2: Connect and Get Teams Settings
In the previous posts we used TfsTeamService to get all teams under the Team Project. another way is to use the TeamSettingsConfigurationService.
The TeamSettingsConfigurationService has two methods:
- GetTeamConfigurationsForUser
- SetTeamSettings
We’ll use the GetTeamConfigurationsForUser passing the Project Uri, this will return all Teams under that project.
private void btnConnect_Click(object sender, RoutedEventArgs e)
{
var tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
tpp.ShowDialog();
if (tpp.SelectedTeamProjectCollection == null) return;
tfs = tpp.SelectedTeamProjectCollection;
projectInfo = tpp.SelectedProjects[0];
teamConfig = tfs.GetService<TeamSettingsConfigurationService>();
GetTeams();
}
void GetTeams()
{
var configs = teamConfig.GetTeamConfigurationsForUser(new[] { projectInfo.Uri });
listTeams.ItemsSource = configs;
}
Step 3: Get Team Settings
Now when you select a Team from the Teams list we’ll use the TeamSettings object to pull the Areas + Iterations for that Team. You will also have the BacklogIterationPath and CurrentiterationPath properties (as we talked above).

private void listTeams_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listTeams.SelectedItem == null) return;
var teamConfig = listTeams.SelectedItem as TeamConfiguration;
txtBacklogIteration.Text = teamConfig.TeamSettings.BacklogIterationPath;
txtCurrentIteration.Text = teamConfig.TeamSettings.CurrentIterationPath;
listIterations.ItemsSource = teamConfig.TeamSettings.IterationPaths;
listAreas.ItemsSource = teamConfig.TeamSettings.TeamFieldValues;
}

Download Demo Project
Enjoy