Y
Yashgt
Hi,
We are trying to programmtically build a MailItem object in a .NET
program and trying to save it as a .msg file. The code works up to the
point of the SaveAs call, where it hangs indefinitely. What could be
the issue? Please see the code below. We have ensured that no other
instance of Outlook.exe is running when we run our program.
Outlook.Application OutlookApplication = new Outlook.Application();
Outlook.NameSpace olNamespace =
OutlookApplication.GetNamespace("MAPI");
olNamespace.Logon(null, null, false, false);
Outlook.MailItem newMail =
(Outlook.MailItem)OutlookApplication.CreateItem(Outlook.OlItemType.olMailItem);
newMail.To = "(e-mail address removed)";
newMail.Subject = objEmailQueueLog.EmailTemplateSubject;
newMail.Body = objEmailQueueLog.EmailTemplateBody;
newMail.SaveAs(@"C:\aa.msg", Outlook.OlSaveAsType.olMSG);
newMail = null;
olNamespace.Logoff();
olNamespace = null;
Thanks,
Yash
We are trying to programmtically build a MailItem object in a .NET
program and trying to save it as a .msg file. The code works up to the
point of the SaveAs call, where it hangs indefinitely. What could be
the issue? Please see the code below. We have ensured that no other
instance of Outlook.exe is running when we run our program.
Outlook.Application OutlookApplication = new Outlook.Application();
Outlook.NameSpace olNamespace =
OutlookApplication.GetNamespace("MAPI");
olNamespace.Logon(null, null, false, false);
Outlook.MailItem newMail =
(Outlook.MailItem)OutlookApplication.CreateItem(Outlook.OlItemType.olMailItem);
newMail.To = "(e-mail address removed)";
newMail.Subject = objEmailQueueLog.EmailTemplateSubject;
newMail.Body = objEmailQueueLog.EmailTemplateBody;
newMail.SaveAs(@"C:\aa.msg", Outlook.OlSaveAsType.olMSG);
newMail = null;
olNamespace.Logoff();
olNamespace = null;
Thanks,
Yash