首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure DevOps 2020 - GraphClient

Azure DevOps 2020 - GraphClient
EN

Stack Overflow用户
提问于 2020-08-19 08:11:31
回答 1查看 382关注 0票数 0

我找不到一种与微软AzureDevops团队沟通的简单方法。我正在开发一些使用Azure 2019的工具,现在还有Azure 2020 RC。微软反对2019年的SOAP。还有2020年,REST客户端。你在2019年休息客户没有完全提供。GraphClient:https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/?view=azure-devops-rest-6.0在那里失踪了。这意味着,没有办法获得UserGraph和用户,而是通过SOAP的旧方式。

我想,也许使用Azure 2020,它会被改变,但实际上不是。

我正在使用Microsoft.VisualStudio.Services.Client在最新的预览和最新的稳定版本。这是:16.173.0-预览和16.153.0。手动调用REST请求也于事无补。

我的测试代码:

代码语言:javascript
复制
var uriToServer = new Uri("http://localhost:81/DefaultCollection");
var vssBasicCredential = new VssCredentials(new WindowsCredential(new NetworkCredential("test", "test")));
using var vssConnection = new VssConnection(uriToServer, vssBasicCredential);
using var graphHttpClient = vssConnection.GetClient<GraphHttpClient>();
var listUsersAsync = await graphHttpClient.ListUsersAsync();

我们得到了:

代码语言:javascript
复制
handled Exception: System.AggregateException: One or more errors occurred. (API resource location 005e26ec-6b77-4e4f-a986-b3827bf241f5 is not registered on http://localhost:81/DefaultCollection.) ---> 
Microsoft.VisualStudio.Services.WebApi.VssResourceNotFoundException: API resource location 005e26ec-6b77-4e4f-a986-b3827bf241f5 is not registered on http://localhost:81/DefaultCollection.
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.CreateRequestMessageAsync(HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content,
IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, String mediaType)
at Microsoft.VisualStudio.Services.Graph.Client.GraphHttpClient.ListUsersAsync(IEnumerable`1 subjectTypes, String continuationToken, Object userState, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at ConsoleApp1.Program.Main(String[] args) in C:\Users\user\RiderProjects\ConsoleApp1\ConsoleApp1\Program.cs:line 17

问题与2019年相同。当然,其他客户的工作也很完美。

相同的代码对Azure DevOps云非常有效--只需将VssCredentials更改为VssBasicCredentials即可。我知道,如果SSL是活动的,那么你基本可以为服务器工作。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-20 08:44:33

是的,目前Azure DevOps Server 2019和Server 2020没有图形api。

您可以在我们的UserVoice站点上添加对此功能的请求,这是我们提出产品建议的主要论坛。建议提出后,您可以投票,并添加您的意见,为这一反馈。产品团队将提供更新,如果他们看到它。

作为一种选择,您可以尝试使用azure cli。使用Azure命令行接口的Azure DevOps扩展,您可以从命令行管理许多Azure DevOps服务。

Azure DevOps命令行接口(CLI)是用于Azure DevOps Server 2020和Azure DevOps服务的可用

有关如何开始使用Azure DevOps CLI,请参阅此文档

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63482689

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档