Vidarious
Vidarious

Reputation: 826

GetExchangeUser() returns null when Outlook 2016 uses Cached Exchange Mode

Developing for: Outlook 2016 Add-In: VSTO (C#)

My company is running on O365 (Exchange) and I am developing an add-in which collects their exchange user information and does various things. However, it appears that when the Outlook Account Settings is configured with Cached Exchange Mode enabled the GetExchangeUser() returns null.

If I disable the clients Cached Exchange Mode everything works fine. However my company wants to keep this feature enabled.

My rough understanding is that GetExchangeUser() only works when connected to the Exchange Server. I suspect that the Cached mode causes this not to be the case all the time and therefore the method fails. So I'm wondering ..

I have tried a number of suggestions I've found online, none of them have worked. Such as ..

Upvotes: 1

Views: 1250

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66306

Keep in mind that ExchangeUser object (returned from AddressEntry.GetExchangeUser()) does not expose anything you cannot get from AddressEntry.PropertyAccessor.GetProperty().

Verify that the data is actually there - you can do that from OutlookSpy (I am its author): click Namespace button on the OutlookSpy ribbon. Expand CurrentUser property, expand AddressEntry, select MAPIOBJECT property, click "Browse". In the IMailUser window, do you see all the MAPI properties that you need? If you select a property, OutlookSpy will show its DASL name. You can use that DASL property name when calling AddressEntry.PropertyAccessor.GetProperty().

Upvotes: 4

Related Questions