简体   繁体   中英

Get sender email address when multiple mails are opened c#

I have ac# add-in in outlook and I am trying to get the current recipient email address. If only one window with a single mail is opened the code bellow works. If the multiple emails are opened, the code bellow returns the last opened email address. Selection.Count is 1, even if I open 3 emails. Can you please help me?

I have also tried iterate them, but in the Selection, it is retrieved only the last opened email address

foreach (MailItem email in new Microsoft.Office.Interop.Outlook.Application().ActiveExplorer().Selection)
{
    yield return email;
}

不要使用Application.ActiveExplorer ,而是使用Application.ActiveWindow并检查它是Explorer (使用Explorer.Selection集合)还是Inspector (使用Inspector.CurrentItem )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM