C # Outlook add-in receives selected emails

I want to get all the selected emails in my Outlook 2010 add-in. I found this MSDN tutorial , but I am starting in C # and I do not quite understand this line of code:Object selObject = this.Application.ActiveExplorer().Selection[3];

I believe that Selection[]- this is something like an overridden statement, an indexer in C #. But is there a way to see its implementation? If I go through the code, I only see the interfaces, but not the implementations. Therefore, I do not know the structure of the Selection object. What really stands for operator [].

Also, why do selected items start at index 1 rather than 0?

+5
source share
2 answers

.
[] Selection.Item() - .
- Outlook.
Outlook 1, 0. VB, Outlook .

+4

, . , Outlook Interop:

internal static IEnumerable<MailItem> GetSelectedEmails()
        {
            foreach (MailItem email in new Microsoft.Office.Interop.Outlook.Application().ActiveExplorer().Selection)
            {
                yield return email;
            }
        }
+1

All Articles