C# Outlook add-in get selected emails

眉间皱痕 提交于 2019-12-05 08:53:34

That lines retrieves the third selected message.
Selection[] is equivalent to Selection.Item() - Item function is marked as the indexed property accessor.
You cannot see the implementation - it is all in the Outlook Object Model.
All Outlook collections begin with 1, not 0. This is how it used to be in VB, so the Outlook Object Model uses the same convention.

I know it's a little late but this question ranks highly in search engines. Here is the solution I use to get selected emails in Outlook Interop:

internal static IEnumerable<MailItem> GetSelectedEmails()
        {
            foreach (MailItem email in new Microsoft.Office.Interop.Outlook.Application().ActiveExplorer().Selection)
            {
                yield return email;
            }
        }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!