none
Get Detailes of read message item RRS feed

  • Question

  • hi

    i'm developing addin for outlook 2010\2013, .net4.

    i can get MailItem stuff for selected mail, like this:

    Microsoft.Office.Interop.Outlook._Application oApp = new Microsoft.Office.Interop.Outlook.Application();
    Object selObject = oApp.ActiveExplorer().Selection[1];
    
    
                if (selObject is Microsoft.Office.Interop.Outlook.MailItem)
                {
                    Microsoft.Office.Interop.Outlook.MailItem mailItem = (selObject as Microsoft.Office.Interop.Outlook.MailItem);
                    lblMailSubject.Text = mailItem.Subject;
                }

    i need to get the info from the readMailItem, so if i have several readMail windows open and i start my addin i want to get the current readMailItem that is open not the main windows selected MailItem.

    10x

    Liran

    Tuesday, March 22, 2016 7:18 AM

Answers

  • Hello Liran,

    You can use the ActiveInspector property of the Application class which returns the topmost Inspector object on the desktop. Use this method to access the Inspector object that the user is most likely to be viewing. If no inspector is active, returns Nothing. Then you can use the CurrentItem property of the Inspector class to get an instance of the Outlook item (for example, MailItem).

    Also you may find the Inspectors property of the Application class helpful. It returns an Inspectors collection object that contains the Inspector objects representing all open inspectors.

    • Marked as answer by liranppo Tuesday, March 22, 2016 6:53 PM
    Tuesday, March 22, 2016 9:08 AM
  • Object item = oApp.ActiveInspoector().CurrentItem;

    See Outlook Object Model Overview

    • Marked as answer by liranppo Tuesday, March 22, 2016 6:53 PM
    Tuesday, March 22, 2016 11:36 AM

All replies