How to get the users for a project in Security in TFS programmatically
-
Monday, February 26, 2007 11:42 AMHi as a part of TFS extensibility i need to make sure that all the projects in TFS should have only group accounts .There should not be any user account in Security.I need to check programmatically, that how many users are there in security who don't come under any group,using TFS API.can any1 help me out in this.
All Replies
-
Monday, February 26, 2007 2:50 PMModerator
Good question - this actually makes for good blog post fodder (I started a forum response, but it was getting kind of long), so I posted one up.
-
Tuesday, February 27, 2007 8:50 AM
Thanks james for the post.But my requirement is bit different.I dont want to see for Team project's groups.Rather i want to make sure that any member in project security should be group accounts.If we right click on a teamproject, then the secutiy option comes wherein we can add a new group or any windows users.I just want to get these Windows users for any of my TFS projects projects.
IGroupSecurityService
gss = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService)); dentity[] projectGroups = gss.ListApplicationGroups(teamproject.ArtifactUri.ToString());This code will list me the application groups for a perticular project.Is there anyway wherein i can list the members in security of a project in TFS. and then check whether they come under any group or not.
In short i need something like the one below
Find all the team projects
- For each of them, get all the members in security
- For each of them, check all the members for whether it's a group or not
I hope my requirement is clear now.
- For each of them, get all the members in security
-
Tuesday, February 27, 2007 10:40 AMModerator
Gotcha - I'll try to make a sample that does that later today.
In the mean time, the method call you want is to read the acl's with IAuthorizationService for the project uri.
-
Tuesday, February 27, 2007 3:15 PMModerator
Here ya go - this does what you want (I think :)
-
Friday, March 02, 2007 8:58 AMThanks James.Its working for me now.

