Order creation works fine for everything other than getting the attachment added to the required folder.
We have tried two ways for it and are getting the same error of the transaction being aborted.
Code Snippet 01
Code: Select all
IAttachmentFolder folderItem = iOrder.Attachments.NewFolder();
folderItem.Name = "Commitments";
IAttachmentFile fileNew =
folderItem.NewFile("sample", @"C:\fullpath\sample.txt", "", AttachmentSource.Attached);
Code Snippet 02
Code: Select all
IAttachmentFolder folderItem = iOrder.Attachments.NewFolder();
folderItem.Name = "Commitments";
using (FileStream stream = File.Open("C:\\fullpath\\sample.txt", FileMode.Open))
{
IAttachmentFile newFile =
folderItem.NewFile("sample", stream, ".txt", "", AttachmentSource.Attached);
}
Any idea on attaching documents would help.
Thanks !!!
The error we are getting is - "The transaction has aborted."