0

We can add programmatically users and groups to TFS, and add AD users/groups in TFS using administrative context for a team project. But can I add groups with users from the Active Directory to the TFS collection programatically? I'm working on the following situation: after creating a new group with users on AD, include it in TFS collection programatically.

I'm interested in a .NET C# solution if possible.

Dale K
  • 25,246
  • 15
  • 42
  • 71
K. Alex
  • 33
  • 1
  • 1
  • 5

1 Answers1

0

Check the answer in this post:

You can use the code snippet to add windows users to TFS.

"

var collection = new TfsTeamProjectCollection(new Uri("http://mytfs:8080/tfs/MyCollection"));
var identityService = collection.GetService<IIdentityManagementService>();
var readIdentity = identityService.ReadIdentity(IdentitySearchFactory.AccountName, @"[domailName here]\" + userName, MembershipQuery.Direct, ReadIdentityOptions.None);

"

Other useful posts for your reference:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/ed719386-925b-49a3-a7d7-5c2a147c7da2/add-ad-group-to-tfs-group-programmatically?forum=tfsadmin

How to add users programmatically to TFS

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