以编程方式将Active Directory中的组和用户添加到TFS

时间:2015-12-04 13:44:46

标签: c# tfs active-directory tfs-sdk

我们可以通过编程方式将用户和组添加到TFS,并使用组织项目的管理上下文在TFS中添加AD用户/组。但是,我可以以编程方式将具有Active Directory用户的组添加到TFS集合吗?我正在处理以下情况:在AD上创建一个包含用户的新组后,以编程方式将其包含在TFS集合中。

如果可能,我对.NET C#解决方案感兴趣。

1 个答案:

答案 0 :(得分:0)

检查this帖子中的答案:

您可以使用代码段将Windows用户添加到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);

&#34;

其他有用的帖子供您参考:

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