add users to team foundation server 2008 using TFS SDK
How do I add users to the contributors group of one of my TFS 2008 projects using T开发者_JS百科FS SDK?
I think does what you need (untested):
# 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)
Translating to C# or other .Net languages should be simple.
精彩评论