我正在尝试在触发SendUsingAccount PropertyChange时检索新的SmtpAddress。
事件被名为“SendUsingAccount”的事件触发,但值未更新。如何从SendUsingAccount获取更新的属性?
private void AutoSignatureRibbon_Load(object sender, RibbonUIEventArgs e)
{
// Get MailItem
Microsoft.Office.Interop.Outlook.Inspector inspector = this.Context as Microsoft.Office.Interop.Outlook.Inspector;
Microsoft.Office.Interop.Outlook.MailItem mailItem = inspector.CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;
// Property Change Event
mailItem.PropertyChange += MailItem_PropertyChange;
// Get Sender
string senderMail = mailItem.SendUsingAccount.SmtpAddress;
}
private void MailItem_PropertyChange(string Name)
{
// Get Updated MailItem
Microsoft.Office.Interop.Outlook.Inspector inspector = this.Context as Microsoft.Office.Interop.Outlook.Inspector;
Microsoft.Office.Interop.Outlook.MailItem mailItem = inspector.CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;
// Get Sender
string senderMail = mailItem.SendUsingAccount.SmtpAddress;
}