none
VSTO - AddIn for Office Outlook 2010 - Creating MailItem programitically RRS feed

  • Question

  • I am coding a VSTO Add-In using VS 2010 and Outlook 2010. I have the following code:

    MailItem mailItem = (Outlook.MailItem)Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem);
                    mailItem.Display(true);
                    mailItem.To = "an email address";
                    mailItem.Subject = "Test";
                    mailItem.BodyFormat = OlBodyFormat.olFormatHTML;
                    

    I have a button in the Ribbon. When the user press the button, my code is executed and the user can see a inspector window with prefilled To address and Subject. The user insert text in body and press the standart "Send" button.

    The problem is that it is not possible to resize the inspector window. It only have (Maximize and Close).

    When the user use the standart "New Email" button, then the inspector windows does have (Minimize, Maximize and Close).

    Its not possible to Minimize the inspector windows when my code creates a new mail.

    Tuesday, February 25, 2014 10:50 AM

Answers

  • Hello Erkan,

    You just need to pass false to the Display method of the MailItem class.

    MailItem mailItem = (Outlook.MailItem)Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem); mailItem.To = "an email address"; mailItem.Subject = "Test"; mailItem.BodyFormat = OlBodyFormat.olFormatHTML;

    mailItem.Display(false);


    Tuesday, February 25, 2014 11:45 AM

All replies

  • Hello Erkan,

    You just need to pass false to the Display method of the MailItem class.

    MailItem mailItem = (Outlook.MailItem)Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem); mailItem.To = "an email address"; mailItem.Subject = "Test"; mailItem.BodyFormat = OlBodyFormat.olFormatHTML;

    mailItem.Display(false);


    Tuesday, February 25, 2014 11:45 AM
  • Thanks a lot. That helped it.
    Wednesday, February 26, 2014 12:53 PM