I'm currently attempting to implement a service which uses EWS to make updates to the outlook contacts of users but I'm having a bit of trouble correctly writing to the email address fields. Note that I'm not an Exchange developer and I'm a newbie when it comes to EWS.
When using the FindItems() method to search a user's contacts folder, the returned Contact objects have their email address fields as the correct SMTP address ([email protected]). However, when I update and save the contact, the next I time retrieve that contact, the email address field displays the LegacyDN address (/o=Blah/ou=Exchange Administrative Group/cn=Recipients/cn=Blah). This occurs even if I write the exact same SMTP address to the contacts field when updating.
Somehow, EWS seems to be internally converting the SMTP address to an ExchangeLDn address. This is problematic for a number reasons. In particular, it seems to be breaking some of our other services that read from the exchange server and it makes it impossible to correctly display the email address without doing a very slow ResolveName call. Is there a way to stop EWS from doing this? A different service which uses Outlook Redemption has no problem properly writing an SMTP address but we're attempting to retire that service and the use of the Redemption API. I should also mention that this problem only occurs when updating contacts for internal users. External users always write the correct SMTP address.
Thanks.