使用TFS SDK将用户添加到team foundation server 2008

时间:2009-11-09 13:21:07

标签: tfs tfs2008 tfs-sdk

如何使用TFS SDK将用户添加到我的某个TFS 2008项目的贡献者组中?

1 个答案:

答案 0 :(得分:0)

我认为你需要的(未经测试):

# add me to the Contributors security group on MyTeamProject
$tfs = Get-TfsServer njtfs -all
$user = $tfs.gss.ReadIdentityFromSource($tfs.GSS_SearchFactor::AccountName, "rberg")
$uri = $tfs.css.GetProjectFromName("MyTeamProject").uri
$role = $tfs.gss.ListApplicationGroups($uri) | ? { $_.displayname -match "Contributors" }
$tfs.gss.AddMemberToApplicationGroup($role.Sid, $user.Sid)

转换为C#或其他.Net语言应该很简单。