How to obtain the mouse click event in the Inbox pane when a user selects an e-mail

advertisements

I am creating a addin for Office 2007 using C#. This addin is responsible to display email header information in a new pane whenever a user clicks on email from email list within Inbox pane. Now I am not sure how do I get mouse click event on the Inbox pane when a user selected an email and read that emails header information. Any helpful pointer?


You can use the Microsoft V11.0 outlook object library (add the reference) and then query 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 inboxes with MAPI or POP3: C# MAPI to read exchange server inbox

Now, to get which inbox message has been selected, you could 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);
                }
            }