I am trying to add a new item into fortress with an attachment. I can add a new item fine but when I try to add an attatchment I get the following error:
[System.InvalidOperationException] = {"There was an error generating the XML document."}
InnerException = {"System.Web.HttpInputStream cannot be serialized because it does not have a parameterless constructor."}
Message = "There was an error generating the XML document."
I am using the following code to upload the attachment:
Code: Select all
MantisItemAttachmentFullDetail objAttachment = new MantisItemAttachmentFullDetail();
MantisItemAttachmentFullDetailColl objAttFullDetailCol = new MantisItemAttachmentFullDetailColl();
HttpPostedFile hpfAttachment = filFile.PostedFile;
if (hpfAttachment.ContentLength != 0)
{
string sStrippedPath = Common.StripPath(hpfAttachment.FileName);
objAttachment.AttStream = hpfAttachment.InputStream;
objAttachment.ContentType = hpfAttachment.ContentType;
objAttachment.FileCRC = 0;
objAttachment.FileLength = hpfAttachment.ContentLength;
objAttachment.Description = "Test";
objAttachment.FileName = sStrippedPath;
objAttFullDetailCol.Add(objAttachment);
}
Code: Select all
MantisItem objItem = new MantisItem();
// Other item details here
objItem.AddedAttachments = objAttachment;
ItemTrackingOperations.ProcessCommandAddFortressItem(objItem);