Hi Guys,
I have an issue regarding to send file to the user. I am running the batch and consolidate all the records and send the file to the user. Here is my code below. But I have an error to display after batch running "An internal error has occurred. Please contact your system administrator".
//Zip File
using(System.IO.MemoryStream zipArchiveStream = new System.IO.MemoryStream())
{
using (ZipArchive zipArchive = new ZipArchive(zipArchiveStream, ZipArchiveMode::Create, true))
{
ListEnumerator sb = lstSales.getEnumerator();
while(sb.moveNext())
{
BAMSalesOrderHeader header = sb.current() as BAMSalesOrderHeader;
ZipArchiveEntry dataFileEntry = zipArchive.CreateEntry(header.FileName());
using (System.IO.Stream dataFileEntryStream = dataFileEntry.Open())
{
this.ReadTextInList(header, dataFileEntryStream);
}
}
}
File::SendFileToUser(zipArchiveStream, package extensionZIP);
}
}
Thank you for your response.
Regards,
CJ