Quantcast
Channel: Team Foundation Server - General forum
Viewing all articles
Browse latest Browse all 6687

How retrive Build , workitem, shared queries permissions using c# code

$
0
0
TeamFoundationIdentity[] pro_groups = sec_groups.ListApplicationGroups(TP.ArtifactUri.ToString(), ReadIdentityOptions.ExtendedProperties);

                        foreach (TeamFoundationIdentity app_grp in pro_groups)
                        {
                            TeamFoundationIdentity ProjectjGroup = sec_groups.ReadIdentity(app_grp.Descriptor, MembershipQuery.Expanded, ReadIdentityOptions.ExtendedProperties);
                            id = ProjectjGroup.Descriptor;


                        }


    string projectSecurityTokenALM = "$PROJECT:" + "vstfs:///Classification/TeamProject/aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa";
         ISecurityService sec = (ISecurityService)sourceTFS.GetService(typeof(ISecurityService));
                var secnames = sec.GetSecurityNamespaces();

  List<IdentityDescriptor> ids = new List<IdentityDescriptor>();
 foreach (SecurityNamespace sn in secnames)
                {
                    if (sn.Description.DisplayName == "Build")
                    {


                        SecurityNamespace buildSecurityNamespace = sec.GetSecurityNamespace(sn.Description.NamespaceId);
                        AccessControlList buildAccessList = buildSecurityNamespace.QueryAccessControlList(projectSecurityTokenALM, new List<IdentityDescriptor> { id }, true);
                    }
                }
Above is the code in which i am trying to retrieve build permissions , but i am not able to get them , is there anything wrong i am  doing here ? 

Viewing all articles
Browse latest Browse all 6687

Trending Articles