How to get currently viewed message in Outlook Inbox folder
I'm writing an Application-Level Add-In for MS Outlook and now I need to determine what message is currently sele开发者_如何学Ccted in Inbox folder (I mean the letter user is currently looking to). Can anyone help me?
Ok, eventually I've found an answer, hope it will help somebody. Here it is:
var explorer = _appOutlook.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);
}
}
精彩评论