how to list the users/groups the server knows about?


The GroupSecurityService inside Team Foundation, specifically the ReadIdentity and ReadIdentities methods, are what you want to use.


    TeamFoundationServer m_tfServer = TeamFoundationServerFactory.GetServer("http://jmanning-test:8080");


    IGroupSecurityService gss = (IGroupSecurityService)m_tfServer.GetService(typeof(IGroupSecurityService));


 


    // first resolve to the SID's


    Identity validUserSids = gss.ReadIdentity(SearchFactor.AccountName, "Team Foundation Valid Users", QueryMembership.Expanded);


 


    // Now resolve the SID's to actual identities


    Identity[] validUsers = gss.ReadIdentities(SearchFactor.Sid, validUserSids.Members, QueryMembership.None);


 


    Console.WriteLine("All valid users/groups:");


    foreach (Identity validUser in validUsers)


    {


        Console.WriteLine(@"{0}\{1} ({2}) [{3}]", validUser.Domain, validUser.AccountName, validUser.DisplayName, validUser.Type);


    }


 


 


Comments (6)

  1. Shawn Cicoria points us to some Team System Utilities.

    Abhinaba is moving on to a new team.

    Michael…

  2. mruminer says:

    Off topic: You posted a comment on my blog with congrats about the triplets-  

    http://blog.magenic.com/michaelr/archive/2006/05/03/2340.aspx#FeedBack

    Just now taking the time to respond back and say thanks!

  3. Buck Hodges says:

    I recently had to put together a list of links to code samples.  This isn’t even close to comprehensive,…

  4. Buck Hodges says:

    I recently had to put together a list of links to code samples.  This isn’t even close to comprehensive,…

  5. La arquitectura de Team Foundation esta orientada a servicios, no en el sentido que utiliza servicios

  6. Adam Singer says:

    Man have I been busy. What have I been busy doing? Well, see there’s…. actually, I’ll let Brian explan

Skip to main content