Basically, the team members power tool displays the list of users in the “[TEAMPROJECT]\Contributors” group of your team project recursively. To customize which group is the one to be displayed you can right click on the team project –> Team Project Settings –> Team Members and select the group you want to get displayed in the node.

You can get this list programmatically by accessing the Identity Management Service. This is a sample code that will do so :

   1: using System;
   2: using Microsoft.TeamFoundation.Client;
   3: using Microsoft.TeamFoundation.Framework.Client;
   4: using Microsoft.TeamFoundation.Framework.Common;
   5:  
   6: namespace DisplayTeamMembers
   7: {
   8:     class Program
   9:     {
  10:         static void Main(string[] args)
  11:         {
  12:             string serverName = @"http://SERVERNAME:8080/DefaultCollection";
  13:             string groupName = @"[ProjectName]\Contributors";
  14:  
  15:             TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(serverName));
  16:             
  17:             //1.Get the Idenitity Management Service
  18:             IIdentityManagementService ims = tfs.GetService<IIdentityManagementService>();
  19:  
  20:             //2.Read the group represnting the root node
  21:             TeamFoundationIdentity rootIdentity = ims.ReadIdentity(IdentitySearchFactor.AccountName,
  22:                 groupName, MembershipQuery.Direct, ReadIdentityOptions.None);
  23:  
  24:             //3.Recursively parse the members of the group
  25:             DisplayGroupTree(ims, rootIdentity, 0);
  26:  
  27:             //4.Exit
  28:             Console.WriteLine("Press any key to exit...");
  29:             Console.ReadKey();
  30:         }
  31:  
  32:         private static void DisplayGroupTree(IIdentityManagementService ims, TeamFoundationIdentity node, 
  33:             int level)
  34:         {
  35:             DisplayNode(node, level);
  36:  
  37:             if (!node.IsContainer)
  38:                 return;
  39:  
  40:             TeamFoundationIdentity[] nodeMembers = ims.ReadIdentities(node.Members, MembershipQuery.Direct, 
  41:                 ReadIdentityOptions.None);
  42:  
  43:             int newLevel = level + 1;
  44:             foreach (TeamFoundationIdentity member in nodeMembers)
  45:                 DisplayGroupTree(ims, member, newLevel);
  46:         }
  47:  
  48:         private static void DisplayNode(TeamFoundationIdentity node, int level)
  49:         {
  50:             for (int tabCount = 0; tabCount < level; tabCount++) Console.Write("\t");
  51:  
  52:             Console.WriteLine(node.DisplayName);
  53:         }
  54:     }
  55: }