0

At Present i'm able to get all the users in TFS for AssignedTo Field by fallowing code:

var tfs = TeamFoundationServerFactory.GetServer("http://vstspioneer:8080/tfs/VSTSDF");
var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
var allowedValues = workItemStore.FieldDefinitions[CoreField.AssignedTo].AllowedValues;

foreach (String value in allowedValues)
{
    Console.WriteLine(value);
}

But my requirement is to fetch only the users who belongs to certain group("In Group").

I know that we can make use of FilteredAllowedValues with an filter. But my question is what to add in the filter if we want to fetch only certain group members.

var filters = new FieldFilterList();
  filters.Add(new FieldFilter(workItemStore.FieldDefinitions[CoreField.AssignedTo], ????));

var allowedValues = workItemStore.FieldDefinitions[CoreField.AssignedTo].FilteredAllowedValues(filters);

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

You can get all application groups with IIdentityManagementService.ListApplicationGroups Method first :

var sec = tfs.GetService<IIdentityManagementService>();
Identity[] appGroups = sec.ListApplicationGroups(teamProject.ArtifactUri.AbsoluteUri);

Then you can get all members with in the Application Groups with IIdentityManagementService.ReadIdentities Method.

This blog provides more details, you can check it: http://geekswithblogs.net/TarunArora/archive/2011/09/30/tfs-sdk-get-groups-users-permissions-using-tfs-api-with.aspx

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39