开发者

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);
                    }
                }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜