Outlook Addin 中的 Recipient.Name 和 ExchangeUser.Name 有什麼區別? (What is the Difference Between Recipient.Name and ExchangeUser.Name in Outlook Addin?)


問題描述

Outlook Addin 中的 Recipient.Name 和 ExchangeUser.Name 有什麼區別? (What is the Difference Between Recipient.Name and ExchangeUser.Name in Outlook Addin?)

ExchangeUser</code> 使用 Recipient.AddressEntry.GetExchangeUser()。我使用哪個 name 屬性是否重要?兩者之間有什麼區別(除了文檔的寫入/讀取差異)。</p>


參考解法

方法 1:

I am not an expert on Microsoft product line. But just from the naming, Outlook is a client and Exchange is a server.

That is to say, you can use Recipient object to refer to an addressee in your Outlook client, no matter what the actual mail server is, it can be Exchange, as in your case, or it can be Gmail, Yahoo! Mail, mail.live.com, whatever.

And the ExchangeUser object is specifically used for Exchange mailbox user, which is typically set up in enterprise. So you can find detailed properties like JobTitle and OfficeLocation (and a lot more) which the Recipient object doesn’t have.

This object provides first‑class access to properties applicable to Exchange users such as FirstName, JobTitle, LastName, and OfficeLocation.

Note that you cannot use Recipient.AddressEntry.GetExchangeUser() if you are not connected to an Exchange server.

方法 2:

Recipient object is stored inside the message itself as a row in the recipient table. Recipient.Name corresponds to PR_DISPLAY_NAME. The PR_ENTRYID property in that row (present if the recipient is resolved) points to the address book object. That is what Recipient.AddressEntry returns ‑ it uses recipient's PR_ENTRYID to call IAddrBook::OpenEntry.

The returned AddressEntry.Name can in theory be different from Recipient.Name (one comes from the address book object and another from PR_DISPLAY_NAME in the message recipient table). ExchangeUser is essentially an extension of the AddressEntry object with Exchange specific properties, so ExchangeUser.Name should be the same as AddressEntry.Name.

You can see this using OutlookSpy (I am its author) ‑ select a message, go to the GetRecipientTable tab. Right lick on the PR_ENTRYID property and select IMAPISession::OpenEntry. You can also edit PR_DISPLAY_NAME property to something different from the GAL object. PR_DISPLAY_TO property on the message will reflect the new recipient name when the message is saved.

(by ThomaskennyzxDmitry Streblechenko)

參考文件

  1. What is the Difference Between Recipient.Name and ExchangeUser.Name in Outlook Addin? (CC BY‑SA 2.5/3.0/4.0)

#outlook #outlook-addin #wpf #C#






相關問題

Outlook 2007/2010 中的 Vspace (Vspace in Outlook 2007/2010)

Outlook 2010 自動完成流(緩存的聯繫人) (Outlook 2010 autocomplete stream ( cached contacts))

如何格式化電子郵件中的字符串以便 Outlook 打印換行符? (How do I format a String in an email so Outlook will print the line breaks?)

通過 Office 加載項將內容添加到 Outlook 電子郵件正文 (Adding content to an Outlook email body via an Office Add-In)

Outlook Addin 中的 Recipient.Name 和 ExchangeUser.Name 有什麼區別? (What is the Difference Between Recipient.Name and ExchangeUser.Name in Outlook Addin?)

運行時錯誤,用於電子郵件自動化的 VBA EXCEL (Runtime Error, VBA EXCEL for email automation)

將 Crystal Reports 轉換為 HTML 並作為正文發送到我的郵件中 (Crystal Reports into HTML and sending in my mail as body)

通過 VBA 將格式化的電子郵件正文複製到新的 Word 文檔中並保留文本格式 (Copy formatted Email body into new Word document via VBA and keep the text formatting)

Outlook 在啟動時忽略加載項的 HKEY_LOCAL_MACHINE 條目 (Outlook ignoring HKEY_LOCAL_MACHINE entry for add-in on startup)

如何知道是否收到或發送了電子郵件? (How to know if an e-mail was received or sent?)

如何從 Excel 表格創建電子郵件? (How to create emails from Excel table?)

如何在 Outlook 正文中左對齊從 Excel 範圍創建的 HTML 表格? (How to Left-Align HTML Table, created from an Excel Range, in an Outlook Body?)







留言討論