Exchange.WebServices.Data.Contact:邮件地址在哪里?

时间:2017-08-31 16:19:09

标签: c# outlook exchange-server exchangewebservices contacts

我在Exchange.WebServices.Data.Contact中找到与Outlook.ContactItem.SelectedMailingAddress相关的属性?

Outlook具有Outlook.ContactItem.SelectedMailingAddress属性,该属性包含Microsoft.Office.Interop.Outlook.OlMailingAddress枚举:

_currentContact.SelectedMailingAddress = Microsoft.Office.Interop.Outlook.OlMailingAddress.olBusiness;

Outlook还会填充一整套地址属性:

_currentContact.MailingAddress = _currentContact.BusinessAddress;
_currentContact.MailingAddressCity = _currentContact.BusinessAddressCity;
_currentContact.MailingAddressCountry = _currentContact.BusinessAddressCountry;
_currentContact.MailingAddressPostalCode = _currentContact.BusinessAddressPostalCode;
_currentContact.MailingAddressState = _currentContact.BusinessAddressState;
_currentContact.MailingAddressStreet = _currentContact.BusinessAddressStreet;

但我在EWS中找不到邮寄地址。 Exchange.WebServices.Data.PhysicalAddressKey枚举仅包含Business,Home和Other。

我把头发拉出来了!任何帮助或方向都将得到真正的赞赏。

由于

1 个答案:

答案 0 :(得分:1)

PidLidPostalAddressId https://msdn.microsoft.com/en-us/library/ee179151(v=exchg.80).aspx属性指定将哪些地址用作邮政地址。在EWS中,您需要使用扩展属性设置它(或获取该值),例如

ExtendedPropertyDefinition PidLidPostalAddressId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8022, MapiPropertyType.Integer);
Contact.SetExtendedProperty(PidLidPostalAddressId, 0x00000002);

将邮件地址设置为商家地址