2014-10-21 55 views
1

希望能得到一點點的幫助,這是一個今天難倒我:我們如何獲得Outlook收件人的實際電子郵件地址?

Outlook.MailItem mail = (Outlook.MailItem)Item; 
Outlook.Recipients recips = mail.Recipients; 
string toField = recips[1].Address; 

我沒有得到實際的地址返回。我試過MSDN網站上的建議,但沒有運氣。具體而言,PR_SMTP_ADDRESS服務已停止:

Const PR_SMTP_ADDRESS As String = _ 
    "http://schemas.microsoft.com/mapi/proptag/0x39FE001E" 

非常感謝您提供的所有幫助。

回答

2

使用Recipient.AddressEntry獲取AddressEntry對象。檢查AddressEntry.Type屬性是否爲SMTP,只需使用AddressEntry.Address即可。如果是EX,請使用AddressEntry.GetExchangeUser.PrimarySmtpAddress.

+0

是的!謝謝!! – Finn 2014-10-22 16:42:53

+0

確保正確處理錯誤 - Recipient.AddressEntry將針對未解析的收件人返回null,或者如果無法打開地址條目,則會引發錯誤。 – 2014-10-22 17:16:02

相關問題