Hi, In my spare time, out of curiosity, I am architecting/desinging a module to MS CRM from DAX4.0/SP2. Everything got installed and running on my local machine.
I need some help on the axapta code to capture the error code during emailing via outlook.. In a sceanrio, I go and talk to my MS CRM DB and get all the contact emails , attach several files automatically and open the outlook express. The snapshot of the code is as below: if( New sqlsystem().databaseName() == 'SUBBU_DB' ) { try { outlook = new COM('Outlook.Application'); if (outlook) { outlookMailItem = outlook.createItem(0); if (outlookMailItem) { outlookAttachments = outlookMailItem.Attachments(); if (outlookAttachments) { select FstmpEmailList; outlookMailItem.subject( 'Order confirmation for week ' + int2str (wkofyr(systemdateget()))); subjectString = 'Order confirmation for week ' + int2str(wkofyr (systemdateget())+1); outlookMailItem.subject(subjectString); outlookMailItem.body(Sales.EmailNotesbasedonTemplate); outlookMailItem.CC(SYSuSerInfo::find(curuserId()).Email); while select AttachConfirmAtionFilesLocal { outlookAttachments.Add(AttachConfirmAtionFilesLocal.FileName, 1, 1,AttachConfirmAtionFilesLocal.FileName); sysProgressbar.setText('Attaching files wait....'); sysProgressbar.incCount(); } sysProgressbar.kill(); outlookMailItem.display(); This opens the outlook mail with all the files attached etc etc. In order to retrive the email sent status, I am using the below piece of code which is not working. Probably, I am doing something wrong. if( outlookMailItem.error().number() < 0) { // oops there is an error in transmitting the emails } else { //email sent succesfully //upload the histroy } Is there anyway that I can communicate back to axapta that the email is sent succesfully based on any return code from outlookMailItem object?. Appreciate your help. kind regards, Subbu Oneneck IT services.