WebService - adding an attachement to the existing issue. HOW?
Hello,
I'm trying to add attachement to the existing issue. I took the code from the other post: Web Services - Creating attachments but neither IssueServices.UpdateIssue() or IssueServices.UpdateFullIssue() add the attachement to the issue. What is the right way to do this?
public void AddIssueAttachement(IssueEN issue, string fileAbsPath, string shortFileName)
{
FileEN[] files = new FileEN[1];
files[0] = new FileEN();
System.IO.FileInfo attachment = new System.IO.FileInfo(fileAbsPath);
byte[] bytes;
using (FileStream fs = attachment.OpenRead())
{
bytes = new byte[fs.Length];
fs.Read(bytes, 0, (int) fs.Length);
}
files[0].FileData = bytes;
files[0].ContentType = "image/jpeg";
files[0].ContentLength = bytes.Length;
files[0].FileName = shortFileName;
files[0].ProjectID = issue.ProjectID;
files[0].IssueID = issue.IssueID;
// other user said null or 0 doesn't work for him.
// but commenting the line below doesn't help either.
files[0].CommentID = 12;
issue.Attachments = files;
Manager.IssueServices.UpdateIssue(issue);
// Manager.IssueServices.UpdateFullIssue(issue);
}
Thank you.
avs099
· 1 |
|
Tuesday, September 16, 2008, 6:04:15 PM |