Ask a questionAsk a question
 

General DiscussionOpening outlook mail item blocks operation on Outlook

  • Tuesday, October 27, 2009 12:46 PMNeeti Kapoor Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have a C# application that sends out email using Microsoft Outlook. The reference added is - Microsoft.Office.Interop.Outlook, Version=11.0.0.0.
    Now when the mail item gets opened with a file attached to it - two issues arise :

    1. Cannot open the attachment. It opens when this mail item is closed/sent.
    2. Cannot perform any operation on both - application and Outlook.

    The OS is Vista. Is this an expected behaviour or some issue with our code ?

All Replies

  • Wednesday, October 28, 2009 8:39 AMNeeti Kapoor Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    No replies !!!!! :(
  • Wednesday, October 28, 2009 11:14 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello
    '
    Do you see this problem in pre-Vista systems?

    Could you post your code snippet to send the email with attachment here?



    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Monday, November 02, 2009 10:47 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello

    How are you? Do you get any progress in this issue? Could you please check out my last reply?

    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Friday, November 06, 2009 6:16 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 10, 2009 7:33 AMNeeti Kapoor Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Very sorry for the delay. I was stuck with something else.
    Well here is the code :
    ------------------------------ 

    //Get Outlook object.

    Microsoft.Office.Interop.Outlook.Application outlookObj = new Microsoft.Office.Interop.Outlook.Application();

     

    if (outlookObj == null)

    {

    System.Diagnostics.Process.Start("Outlook.exe");

    outlookObj = new Microsoft.Office.Interop.Outlook.Application();

    }

     

    Microsoft.Office.Interop.Outlook.MailItem outlookMailItem = (Microsoft.Office.Interop.Outlook.MailItem)outlookObj.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

     

    if (outlookMailItem == null)

    {

    System.Diagnostics.Process.Start("Outlook.exe");

    outlookMailItem = (Microsoft.Office.Interop.Outlook.MailItem)outlookObj.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

    }

     

    outlookMailItem.To = "abc@xyz.com";

     

    outlookMailItem.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;

     

    outlookMailItem.Attachments.Add(this.errorLogFilePath, (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, 1, null);

     

    outlookMailItem.Display(new object());