View Single Post
  #1  
Old May 29th 08, 01:58 PM posted to microsoft.public.outlook.interop,microsoft.public.outlook.general,microsoft.public.outlook.program_forms
Yashgt
external usenet poster
 
Posts: 1
Default Outlook automation SaveAs method hangs

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(Ou tlook.OlItemType.olMailItem);
newMail.To = ";
newMail.Subject = objEmailQueueLog.EmailTemplateSubject;
newMail.Body = objEmailQueueLog.EmailTemplateBody;
", Outlook.OlSaveAsType.olMSG);
newMail = null;
olNamespace.Logoff();
olNamespace = null;

Thanks,
Yash
Ads