Update issue relations
Is it possible to update issue's relations with UpdateObject() command? We use Redmine.Net.API v4.2.3 and Redmine serveur 3.4.11
string host = "host"; string apiKey = "key"; string issueId = "26510";
var manager = new RedmineManager(host, apiKey); var parameters = new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.RELATIONS } };
var issue = manager.GetObject<Issue>(issueId, parameters); issue.Description = "New description";
IssueRelation newRelation = new IssueRelation(); newRelation.Delay = 0; newRelation.Type = IssueRelationType.Relates; newRelation.IssueToId = 26508;
issue.Relations.Add(newRelation); //issue.Relations already contains 1 relation. We add a new one
manager.UpdateObject(issueId, issue); var updatedIssue = manager.GetObject<Issue>(issueId, parameters); //updatedIssue still has 1 relation
Hi, You can't do it like that. If you want to add a new relation to a specific issue you have to do it like that:
...
IssueRelation newRelation = new IssueRelation();
newRelation.Delay = 0;
newRelation.Type = IssueRelationType.Relates;
newRelation.IssueToId = 26508;
manager.CreateObject(newRelation);
var updatedIssue = manager.GetObject(issueId, parameters); //updatedIssue will have 2 relations