Share via


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("https://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

  • Anonymous
    May 03, 2006
    Shawn Cicoria points us to some Team System Utilities.

    Abhinaba is moving on to a new team.

    Michael...
  • Anonymous
    May 25, 2006
    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!
  • Anonymous
    August 12, 2006
    I recently had to put together a list of links to code samples.  This isn't even close to comprehensive,...
  • Anonymous
    August 12, 2006
    I recently had to put together a list of links to code samples.  This isn't even close to comprehensive,...
  • Anonymous
    September 06, 2006
    La arquitectura de Team Foundation esta orientada a servicios, no en el sentido que utiliza servicios
  • Anonymous
    February 09, 2007
    Man have I been busy. What have I been busy doing? Well, see there's.... actually, I'll let Brian explan