3

i am able to create project/delete/rename everything but when it come for getting group its says "API resource location ebbe6af8-0b91-4c13-8cf1-777c14858188 is not registered on http://khanamar3:8080/tfs/DefaultCollection/" please help.....

public PagedGraphGroups GetAllGroups()
    {
        VssConnection connection = Context.Connection;
        GraphHttpClient graphClient = connection.GetClient<GraphHttpClient>();
        //error coming in next line...
        PagedGraphGroups groups = graphClient.GetGroupsAsync().Result;

        foreach (var group in groups.GraphGroups)
        {
            LogGroup(group);
        }

        return groups;
    }
riQQ
  • 9,878
  • 7
  • 49
  • 66
amar khan
  • 29
  • 1
  • 4

3 Answers3

6

There might be two problems with

API resource location {0} is not registered on {1}

1. With URL

I think it should be without default collection, so in your example

http://khanamar3:8080/tfs/

2. With TFS/API version (I had this problem myself)

2.1

First check the version of your TFS server in TFS Management for example

C:\Program Files\Microsoft Team Foundation Server 2018\Tools\TfsMgmt.exe

Once you know your TFS Server version you can see which API Version it supports

https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=vsts-rest-tfs-4.1

For example TFS 2018 UPDATE 1 supports API version 4.0

Api version and TFS

2.2

Then check what API version is called by DLLs you use. I coudn't find this information on nuget site https://www.nuget.org/packages/Microsoft.TeamFoundationServer.Client/

UPDATE: You can check which dll version supports which TFS version here: https://learn.microsoft.com/en-us/azure/devops/integrate/concepts/dotnet-client-libraries?view=azure-devops

but as described here How to specify the API version? you can check what API version is passed by the method using ILSpy

Method in your case would be:

GetGroupsAsync

And you can check this using https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.ILSpy

ILSpy example

In my case it looked like this ILSpy result

So API from nuget Versioned 16.153.0 uses calls with 5.1.1

So in my case TFS 2018 UPDATE 1 did not supported API version 5.1.1, so I will need to downgrade nuget or upgrade TFS Server Version (or both)

pawciu
  • 855
  • 9
  • 15
0

You could use IIdentityManagementService with ListApplicationGroups to get the list of application groups.

TeamFoundationIdentity[] ListApplicationGroups(
    string scopeId,
    ReadIdentityOptions readOptions
)

Sample code

var applicationGroups = identityManagementService.ListApplicationGroups(projectcollection.Uri.AbsoluteUri, ReadIdentityOptions.None);

Also take a look at this similar question: TFS 2013 get All TFS group including Windows group

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

With Azure DevOps Server or TFS on prem, this error can also occur if you use the base url (in your case http://khanamar3:8080/tfs/) when authenticating, but later try to use that connection to make a request to something that is inside a project collection like "GetProjects()" or "GetWorkitemTypes(projectName)".

To add to the confusion, some functionality works when authenticating using the base url like "GetProjectCollections()". So if you went about this like I did and authenticated with the base url, and were able to get project collections, and then got the OP's error when trying to get the projects in one of those collections, you may be scratching your head for a few hours.

If you authenticated using the project collection url (http://khanamar3:8080/tfs/DefaultCollection) then invoking functions like "GetProjects()" and "GetWorkItemTypes()" works but "GetProjectCollections()" does not.

StingyJack
  • 19,041
  • 10
  • 63
  • 122