This post is more for my own reference as I spent a bit of time trying to figure this one out. For a long time now you have been able to choose your own Team field in TFS and let TFS know this using the following method https://msdn.microsoft.com/en-us/library/vstudio/dn144940.aspx . I was recently working on an application where I needed to know the Team Fields name programmatically. Below is the code I used to do this.
For the code below to work you will need to include
In the example below we pass in the Guid of the TFS Collection we are after followed by the TFS project name. We then use the Process Configuration Service to get us the details about the project
1 var _tfsTeamProjectCollection = new TfsTeamProjectCollection(new Uri(_tfsUrl),
2 new System.Net.NetworkCredential(_tfsUserName, _tfsPassword));
6 var teamProjectCollection =
9 var settings = teamProjectCollection.GetService<ProjectProcessConfigurationService>();
11 ICommonStructureService4 cssService = teamProjectCollection.GetService<ICommonStructureService4>();
13 var projectInfo = cssService.GetProjectFromName(projectName);
15 var proc = settings.GetProcessConfiguration(projectInfo.Uri);
17 var sets = proc.TypeFields;
19 string teamField = null;
21 foreach (var typeField in sets)
23 if (typeField.Type == FieldTypeEnum.Team)
25 teamField = typeField.Name;
I am sure the above code example can be tidied up and adapted a bit more.