如何将文件附加到Mantis Connect mc_issue_add

时间:2017-03-30 15:56:07

标签: c# mantis

我想知道我是否可以在MantisConnect上使用文件名附加文件。我没有运气就尝试过ff。

var mc = new MantisBt.Service.Client.MantisBt.Api.MantisConnect();
IssueData iIssue = new IssueData() {
    //some other properties here...
    attachments = new AttachmentData[] { 
                          filename = "path-to-my-attachment",
                          date_submitted = DateTime.Now 
                  }
};
string issueID = mc.mc_issue_add(MyUserID, MyPassword, iIssue);

该问题已在Mantis中发布,但附件未添加。我确定"path-to-my-attachment"存在:(FileInfo.Exists == true)

我也尝试过:

IssueData iIssue = new IssueData();
//some other properties here
iIssue.attachments = 
//tried converting a List<AttachmentData> to array
//tried the usual AttachmentData[] method
//tried adding AttachmentData["length here"]

但同样的事情,发布了问题,没有附加附件。

任何?

2 个答案:

答案 0 :(得分:0)

您正在寻找的功能是mc_issue_attachment_addmc_issue_addmc_issue_update不允许添加附件。

答案 1 :(得分:0)

我发现不知何故,填充IssueData的附件属性并通过mc_issue_addmc_issue_update保存问题不会保存附件。唯一的方法是首先保存问题,然后使用id然后使用mc_issue_attachment_add

所以不。您无法使用attachments属性添加批量附件。您需要使用mc_issue_attachment_add逐个添加它们。