'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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1