【发布时间】:2020-04-21 02:30:03
【问题描述】:
我正在密切关注 azure-devops-dotnet-samples CreateBugUsingClientLib() 示例,但是
GetClient<WorkItemTrackingHttpClient>()
正在投掷:
InnerException:{“无法从 System.String 转换或转换为 Microsoft.VisualStudio.Services.Identity.IdentityDescriptor。”} System.Exception {System.ArgumentException}
消息:“将值“Microsoft.IdentityModel.Claims.ClaimsIdentity;stuff\me@contoso.com\”转换为类型“Microsoft.VisualStudio.Services.Identity.IdentityDescriptor”时出错。路径“authenticatedUser.descriptor”
我所有的 NuGet 都是最新的。
// string uri = "https://teams.visualstudio.com/defaultCollection/"
// string pat = "personal access token";
// string project = "Ateam";
// string path = "autobug";
// string title = "you broke it";
// string steps = "you touched it";
var patchDoc = new JsonPatchDocument
{
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.Title", Value = title },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.AreaPath", Value = path },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.TCM.ReproSteps", Value = steps },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.Common.Priority", Value = "2" },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.Common.Severity", Value = "2" }
};
var cred = new VssBasicCredential("", pat);
var conn = new VssConnection(new Uri(uri), cred);
var client = conn.GetClient<WorkItemTrackingHttpClient>();
【问题讨论】:
-
您是如何在代码中定义“stuff\me@contoso.com”的?
-
这是来自个人访问令牌的内容。
标签: c# azure-devops