Search code examples
c#outlookfullscreenmailitem

Outlook mailItem fullscreen


I create an outlook mailItem like this,

Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = mailSubject;
mailItem.Attachments.Add(totalPath);
mailItem.Body = mailBody;
mailItem.Importance = Outlook.OlImportance.olImportanceNormal;


//Edit:
mailItem.Open += new Microsoft.Office.Interop.Outlook.ItemEvents_10_OpenEventHandler(mailItem_open(mailItem));

mailItem.Display(true);
outlookApp.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);

mailitem_open:

private static Outlook.ItemEvents_10_OpenEventHandler mailItem_open(Outlook.MailItem mailItem)
    {
        mailItem.GetInspector.WindowState = Outlook.OlWindowState.olMaximized;
        return null;
    }

When i display the mailitem to get edited by the user, i want the new email to display fullscreen.

Is this even possible? Because i can't find the answer anywhere.

EDIT: see my edit in the code, when i added this row before or after the mailitem.Display(true); the message 'The window isn't opened right now'


Solution

  • You can set the WindowState property of the Inspector class to the olMaximized value. Use the GetInspector method of the MailItem class to get an instance of the Inspector class.