microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
519 stars 511 forks source link

Graph and Azure Server 2019 #294

Open szwalkowski opened 4 years ago

szwalkowski commented 4 years ago

Hey there,

is it actually possible to call https://github.com/microsoft/azure-devops-dotnet-samples/blob/main/ClientLibrary/Samples/Graph/UsersSample.cs this on Azure Server 2019? As far as I can see: https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/users?view=azure-devops-rest-5.1&viewFallbackFrom=azure-devops-server-rest-5.0 it's fallback me to 5.1 when I want to check azure devops server. And using graphClient it throws me:

Microsoft.VisualStudio.Services.WebApi.VssResourceNotFoundException: API resource location 005e26ec-6b77-4e4f-a986-b3827bf241f5 is not registered on http://localhost:81/DefaultCollection.

var vssConnection = new VssConnection(uriToServer, vssBasicCredential); var graphHttpClient = vssConnection.GetClient<GraphHttpClient>(); var listUsersAsync = graphHttpClient.ListUsersAsync().Result; Console.WriteLine(listUsersAsync); Wrongly used result, but that's fastest way to reproduce it.

server version: Version 17.143.28621.4

tried library in versions: 16.153 16.143.2