Andrii Khomiak
Andrii Khomiak

Reputation: 605

VSTO - Getting all accounts

In my addin I need to get all accounts. Now I using

Application.Session.Accounts

but it not contains accounts that added after application start. How to get all accounts (even if it will be added in current aplication session) without restarting application?

Upvotes: 0

Views: 428

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

If Namespace.Accounts.Count does not get updated, you can try to use IOlkAccountManager Extended MAPI interface (if you are using C++ or Delphi). You can play with that interface in OutlookSpy (I am its author) - click IOlkAccountManager button.
In case of languages other than C++ or Delphi, I can only suggest Redemption (I am also its author) and its RDOSession.Accounts collection (returns RDOAccounts object). It does not cache stale data (it is refreshed every time you retrieve the RDOSession.Accounts property) and exposes a few events that fire when accounts are added/modified/deleted.

Upvotes: 1

Related Questions