How to get a mouse click event in the inbox when a user selects an email address

I am creating addin for Office 2007 using C #. This admin is responsible for displaying email header information in a new area when a user clicks on an email from the email list in the Inbox. Now I'm not sure how to get the mouse click event in the Inbox when the user selects an email and read this email header information. Any useful pointer?

+5
source share
2 answers

You can use the Microsoft Outlook V11.0 object library (add a link) and then request a MAPI mailbox:

http://geekswithblogs.net/TimH/archive/2006/05/26/79720.aspx or http://support.microsoft.com/kb/310258

Some requirements for accessing exchange mailboxes with MAPI or POP3: C # MAPI for reading incoming Exchange messages

Now, to select which message for incoming messages has been selected, you can use:

Outlook.Explorer explorer = null;
explorer = outlookObj.ActiveExplorer();
            if (explorer.Selection.Count > 0)
            {
                var sel = explorer.Selection[1];
                if (sel is Microsoft.Office.Interop.Outlook.MailItem)
                {
                    var item = sel as MSOutlook.MailItem;
                    MessageBox.Show("Selected letter: "+item.Body);
                }
            }
0
source
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {

       this.Application.Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);          
    }
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            try
            {
                Outlook.MailItem tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;
                if (tmpMailItem != null)
                {
                    if (Inspector.CurrentItem is Outlook.MailItem)
                    {
                        tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;
                        string to=   tmpMailItem.To;
                        string body = tmpMailItem.Body;
                    }
                }
             }
            catch
            {

            }
        }
0
source

All Articles