2

I'm currently using TFS 2013 (On Premise). I'm unable to find a way to programmatically query the lists of 'Stakeholder', 'Basic' and 'Advanced' users, set in the 'Access Levels' tab of the Control Panel at server level, or, given a valid TeamFoundationIdentity, find out what their corresponding access level is. Is it possible to do this?

I am quite familiar with using the SDK, although only reasonably so when looking up users and security. As an example, I know how to list all Project Collection Valid Users across the server.

TfsConfigurationServer configurationServer

IIdentityManagementService ims = configurationServer.GetService<IIdentityManagementService>();

TeamFoundationIdentity[][] identities = ims.ReadIdentities(IdentitySearchFactor.AccountName,
        new[] { "Project Collection Valid Users" }, MembershipQuery.Expanded, ReadIdentityOptions.ExtendedProperties);

Any help will be greatly appreciated, thanks.

riQQ
  • 9,878
  • 7
  • 49
  • 66
Lee Dalkin
  • 21
  • 2

2 Answers2

0

No, it’s impossible.

It seems there is no official document about how to querying and edit Server Access Level using TFS API.

Please refer to the discussions in below similar posts: https://social.msdn.microsoft.com/Forums/vstudio/en-US/222245c1-5f72-4daa-bc0f-a038ee363bd8/querying-tfs-user-access-level-via-the-object-model?forum=tfsgeneral

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
0

You can read access level of a user using REST Client API.

String collectionUri = "https://{account}.visualstudio.com";
VssCredentials creds = new VssClientCredentials();
creds.Storage = new VssClientCredentialStorage();
VssConnection connection = new VssConnection(new Uri(collectionUri), creds);
var licensingHttpClient = connection.GetClient<LicensingHttpClient>();
var accountEntitlement = licensingHttpClient.GetAccountEntitlementAsync().Result;
var license = accountEntitlement.License;
riQQ
  • 9,878
  • 7
  • 49
  • 66
  • Should this work for TFS (on-premise)? I'm getting a VssResourceNotFoundException: API resource location c01e9fd5-0d8c-4d5e-9a68-734bd8da6a38 is not registered on http://:8080/tfs/ – riQQ Feb 26 '19 at 15:31
  • My previous comment refers to TFS 2018 – riQQ Feb 06 '20 at 14:39