TechTalk.JiraRestClient在jira中创建一个问题 - C#

时间:2016-03-28 16:20:10

标签: c# jira-rest-api

我正在尝试使用TechTalk.JiraRestClient在jira中创建一个问题。以下是我到目前为止所得到的

        JiraClient client = new JiraClient(url, username, password);
        var txt = client.GetIssues("JPA"); //this gets all the issues for that board.
        IssueFields fields = new IssueFields();
        fields.summary = "Create a ticket via automation.";
        fields.description = "This is a test ticket. This ticket was created via automation";
        fields.timetracking.originalEstimate = "0";
        var txt2 = client.CreateIssue("JPA", "Bug", fields);

我无法创建故障单,因为它会抛出以下错误:

  

未处理TechTalk.JiraRestClient.JiraClientException         的HResult = -2146233088         消息=无法创建问题         源= TechTalk.JiraRestClient

的InnerException:

  

ErrorResponse = {“errorMessages”:[],“errors”:{“timetracking”:“字段'时间跟踪'无法设置。它不在适当的屏幕上,或者未知。”}}              的HResult = -2146233088              Message = JIRA返回错误状态:错误请求              来源= TechTalk.JiraRestClient              堆栈跟踪:                   在TechTalk.JiraRestClient.JiraClient`1.AssertStatus(IRestResponse响应,HttpStatusCode状态)                   at TechTalk.JiraRestClient.JiraClient'1.CreateIssue(String projectKey,String issueType,TIssueFields issueFields)              InnerException:

即使我删除了时间跟踪字段,它也会抛出相同的错误。我不知道如何解决这个问题。任何帮助都会很棒!

谢谢 - KP

1 个答案:

答案 0 :(得分:0)

将时间跟踪设置为null可以解决此问题。

fields.timetracking = null;