none
List TFS Server Group Permissions in C#

    Question

  • I am trying to write a small console app to list all the TFS server level groups and their permissions.  I can get a list of groups using the following code, but I don't know how to get the permissions for each group.  Any help would be greatly appreciated.

    var server = TfsConfigurationServerFactory.GetConfigurationServer("server uri");
    
    var serverIdService = server.GetService<IIdentityManagementService>();
    
    var serverGroups = serverIdService.ListApplicationGroups(null,ReadIdentityOptions.ExtendedProperties);
              
    foreach (var serverGroup in serverGroups)
    
    {
    //Write server permissions for group
    
    }
    

     

     

     

     

    Thursday, April 24, 2014 9:20 PM

All replies

  • Hi XantosX5,

    To get the group permissions for each groups, you can refer to the answer reply of this thread. And also see more information in the blog: TFS SDK Get Groups Users Permissions using TFS API with Linqpad. Thanks for your understanding.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 28, 2014 5:45 AM
    Moderator
  • Thanks for the reply Charles, but the links you provided only get permissions for project groups. I am trying to get permissions for TFS server groups.  The Screen shot below shows the groups that I am trying to get permissions for in my console app.

    Tuesday, April 29, 2014 3:14 PM
  • Hi,

    You need to add your own logic to filter out these global groups. As all these groups has "[TEAM FOUNDATION]" in the DisplayName, maybe you can modify your code to be similar to:

    var server = TfsConfigurationServerFactory.GetConfigurationServer("server uri");
    var serverIdService = server.GetService<IIdentityManagementService>();
    var serverGroups = serverIdService.ListApplicationGroups(null,ReadIdentityOptions.ExtendedProperties);     
    foreach (var serverGroup in serverGroups)
    {
    //Write server permissions for group
     if (serverGroup.DisplayName.Contains("[TEAM FOUNDATION]"))
     {
       //do something here
     }
    
    }
    Thanks.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 01, 2014 5:42 AM
    Moderator
  • Thanks Vicky, but I know how to get the server groups. I just don't know how to get the permissions each group has.
    Thursday, May 01, 2014 2:19 PM
  • Hi,

    I'm trying to involve other experts on your issue.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 06, 2014 6:12 AM
    Moderator
  • Hi,

    I also cannot some API for your requirement.

    Maybe you could call "tf permission" and get the output.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Jun Zh - MSFT Microsoft Online Community Support

    Friday, May 23, 2014 1:52 AM
  • You can simply use one of the below commands to list permissions for all groups or a particular group

    tf permission /collection: http://server:8080/tfs/Collection/

    tf permission /group:[teamproject]\group_name /collection: http://server:8080/tfs/Collection/

    tf permission $/specific_path

    tf permission /group:[teamproject]\group_name $/specific_path

    Wednesday, August 06, 2014 6:18 AM