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.
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:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.