当我尝试通过 MailItem.Sender 获取电子邮件地址时,我收到了 AccessViolationException。Outlook 2007 (Windows XP) 上的地址。当我在 Outlook 2010 (Windows 7) 上运行相同的代码时,我没有收到此错误。
Outlook.MailItem email = inbox.Items[i] as Microsoft.Office.Interop.Outlook.MailItem;
Outlook.MailItem email
Console.WriteLine("Subject: " + email.Subject);
Console.WriteLine("Sender: " + email.Sender); <-- Exception Here!
Console.WriteLine("Addr: " + email.Sender.Address);
控制台:错误:System.AccessViolationException:试图读取或写入受保护的内存。方法:get_Sender()