Monday, March 19, 2018

Export to csv file in D365

fileUploadTemporaryStorageResult result;
AsciiStreamIo filecreate;
System.IO.StreamWriter StreamWriter;
Filename    localfilename , pathname;
System.IO.Stream stream;
TransDate           fromDate;
TransDate           toDate;
FilePath        pathfile;
FilenameSave path;
CommaStreamIo io;
Container Con;
FileIOPermission fileIOPermission;
InteropPermission interopPerm;
str bookingdetails;
;
super();
interopPerm = new InteropPermission(InteropKind::ClrInterop);
interopPerm.assert();
path = "Folder path" +"xxxx.csv";
fileIOPermission = new FileIOPermission(path, "r");
fileIOPermission.assert();
filecreate = AsciiStreamIo::constructForWrite();
con = conins(con,1,"SO Date");
con = conins(con,2,"Order Type");
con = conins(con,3,"Order Status");
con = conins(con,4,"SO Number");
con = conins(con,5,"Bill To");
bookingdetails = con2Str(con,",");
filecreate.write(bookingdetails);
filecreate.Dispose();
CodeAccessPermission::revertAssert();
this.Sendmail();
System.IO.File::Delete(path);

No comments:

Post a Comment