How can ParentIssue cleard using redmine-net452-api.

Added by c28hero hero 5 months ago

Hi.

I'm tring organize tickets using redmine-net452-api(C#).
So, I noticed that there were a lot of unnecessary parent issues.(over 10000!)

I want to delete a lot of unnecessary parent issues, at once.
But I do not want to delete children issue.

var adminMng = new RedmineManager(redmineUrl, apiKey);

// NG: Children is also deleted together.
{
    adminMng.DeleteObject<Issue>(parentIssue.Id.ToString());
}

How can ParentIssue cleard using redmine-net452-api.
The following code all failed.


// NG: System.Collections.Generic.KeyNotFoundException: IssueChild
{
    var children = adminMng.GetObject<Issue>(ticketReq.Id.ToString(), new NameValueCollection()
        {
            { RedmineKeys.INCLUDE, "children" }
        }).Children;

    foreach (var child in children)
    {
        adminMng.DeleteObject<IssueChild>(child.Id.ToString());
    }
}

// NG: Redmine.Net.Api.Exceptions.RedmineException: UpdateObject has invalid or missing attribute parameters.
{
    var childIssue = adminMng.GetObject<Issue>(childIssueId, new NameValueCollection()
                {
                    { RedmineKeys.INCLUDE, "ParentIssue" }
                });

    childIssue.ParentIssue = new IdentifiableName();
    adminMng.UpdateObject<Issue>(childIssue.Id.ToString(), childIssue);
}

Prease help!!
Thank you for reading poor English.