TFS 11 comes with many great changes for software development, the first and super important is Teams, until TFS 11 Task work item or any other work item has to be assign to individual, means that you can’t assign a Task to a Scrum Team etc…
So many people has built customize solution to handle this but no need! because TFS 11 comes with this great Feature! In TFS Web Management site you can add as many teams as you want under One Team Project.
If your team works with Scrum then you should have a product backlog, but how you can manage two or more backlogs for each team? Working without backlog for teams will make it very difficult to keep track on what our team already completed and the progress on each other Task.
To Solve this you need to Assign Working Area and/or Iteration for Teams.
Now when you create a new Team there is a new Area created with the Team Name, this allow you to assign stuff for that Area path so the team can easily the relevant tasks for her. You can also define a different Area for Each team.
Now to the coding Part….. How to control teams from TFS API..
Step 1: Create Project and Add Reference
Create an WPF application and add the following references:
First add reference for:
- Microsoft.TeamFoundation.Build.Client (18.104.22.168)
- Microsoft.TeamFoundation.Build.Common.dll (22.214.171.124)
(C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0\)
Step 2: Connect Team Foundation Server
Now, this part should be familiar, connecting to TFS server, there is plenty but the once I love the most if using TeamProjectPicker. After connect TFS we need to get a new service called – TfsTeamService – as you can understand from the name it has relation to Teams…
Using the Team Service we can query, add, remove and more but for now we’ll see how to get the full teams list and get team members.
After I receive the teamservice I used QueryTeams method with the Team Project Uri (the team project you picked using TeamProjectPicker)
private void btnConnect_Click(object sender, RoutedEventArgs e)
var tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
if (tpp.SelectedTeamProjectCollection == null) return;
tfs = tpp.SelectedTeamProjectCollection;
teamService = tfs.GetService<TfsTeamService>();
listTeams.ItemsSource = teamService.QueryTeams(tpp.SelectedProjects.Uri);
Step 3: Get Members For Team
Now when you click on one team this will get the Team object we call GetMembers method to get all Team Members for that Team.
GetMembers method will return array of TeamFoundationIdentity, you can also change the MemberShipQuery enum to Extended in order to get Groups & Users.
private void listTeams_SelectionChanged(object sender, SelectionChangedEventArgs e)
if (listTeams.SelectedItem == null) return;
var team = listTeams.SelectedItem as TeamFoundationTeam;
listMembers.ItemsSource = team.GetMembers(tfs, MembershipQuery.Direct);