开发者

How to get currently viewed message in Outlook Inbox folder

开发者 https://www.devze.com 2023-01-20 12:21 出处:网络
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). C

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

精彩评论

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