简体   繁体   中英

Add groups and users from Active directory to TFS programatically

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:

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM