none
Looking for "account added" event RRS feed

  • Question

  • Hi!

    I'm developing an add in for Outlook 2013 and I need to capture event when user adds new account

    (when mail settings filled and checked, just after the finish button clicked and a new mailbox added),

    but I cannot find any event for that, the only thing I found is:

    Application.Session.Store.StoreAdd 

    which fires when new store(mailbox) is added for account,  but Accounts collection is not updated at the time the event fires,

    for example, say we have one account added in Outlook, then we add the new one through FILE->Add Account,

    fill Email Address, Password etc. click next, wait for account checking, when the StoreAdd event handler starts

    to execute but if we check:

    Application.Session.Accounts

    it contains only one account which was added first.

    So I need to somehow subscribe for new account adding and also have an access to it when it has been added to Accounts collection or some another way.

    Thanks!

    Wednesday, July 30, 2014 4:10 AM

Answers

All replies

  • Outlook Object Model does not expose account related events. If you were using C++ or Delphi (to be able to use Extended MAPI), you could use IOlkAccountManager interface and set up an event sink using IOlkAccountManager::Advise.

    If using Redemption is an option, you could use its RDOAccounts collection and its events.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by xsunk Thursday, July 31, 2014 7:25 AM
    Wednesday, July 30, 2014 5:25 AM
  • Hello Dmitry,

    is there any possibility to access IOlkAccountManager from managed code (C#)?


    Wednesday, July 30, 2014 8:36 AM
  • Yes, there is. You are free to use it from the managed code, nobody forbids doing so and I can confirm that it works like a charm. A deep knowledge of low-level programming (interopability) is required.

    However, this way is not supported/recommended officially. See What Does "Unsupported" Mean? .

    Wednesday, July 30, 2014 9:16 AM
  • Eugene,

    could you please provide me with a simple example of doing such thing?

    Basically I only need to be notified when the account collection actually updated,

    no additional info required, I believe that DllImport could be used for the trick.

    Wednesday, July 30, 2014 10:16 AM
  • I don't think that posting not supported code is a good idea. if you don't know how to do this, I'd recommend using any third-party wrapper. It will save you a lot of time.
    Wednesday, July 30, 2014 12:27 PM