Rakesh Kamath - Osellus

I need to obtain (programatically, C#) all the group membership of a particular TFS user account - both project and global memberships. What would be the best way to achieve this
Appreciate it.


Re: Team Foundation Server - General Programatically obtain group memberships of a TFS user account

James Manning - MSFT

You can use the IGroupSecurityService's ReadIdentity to get the SID's that it's a member of, then ReadIdentities to translate those SID's to "real" identities.

Once you have those, you can optionally use ICommonStructureService to translate the URI's of the team projects to more friendly names.

I put up a quick blog post with a PowerShell script that does this - translating to C# should be easy enough, but let me know if you have problems.

http://blogs.msdn.com/jmanning/archive/2007/03/09/get-memberships-ps1-programmatically-finding-the-groups-you-re-a-member-of.aspx






Re: Team Foundation Server - General Programatically obtain group memberships of a TFS user account

Rakesh Kamath

Thanks very much James. That was concise and helpful.