none
Regarding Outlook new mail notification on Logon RRS feed

  • Question

  • Hi,

     I am trying to get notification on receive of new mails on logon. fnevNewMail or fnevObjCreated, I get the notifications only after logon. We are hooking the OpenMsgStore. We get the notification in cache mode. But the problem with Non-Cachemode.

    In the OpenMsgStore

    MineOpenMsgStore()

    {

    Call Original OpenMsgStore.

    SMapiAdviseSink *pAdviseSink = pThis->CreateAdviseSink(MAPI_STORE, *lppMDB, TRUE);

    if(pAdviseSink)

    {

    pAdviseSink->lpMAPISession = pSession;

    ULONG ulConnection = 0;

    HRESULT hRes = (*lppMDB)->lpVtbl->Advise(*lppMDB, 0, NULL, fnevNewMail | fnevObjectCreated, (IMAPIAdviseSink *)pAdviseSink, &ulConnection);

    }

    }

    Reproduce steps:

    1. Close OUtlook

    2. Send some mails from different email ID.

    3. Open the Outllok.

    4. We could not find any notification.

    if(hRes == S_OK)

    pThis->m_SinksList.AddTail(pAdviseSink);

    }

    Friday, June 21, 2013 12:27 PM

Answers

  • This is to be expected. These notifications fire when your app is not listening.

    You see these notification in a cached store only because the cached store syncs changes from the server to the local store when your code is already running, not because the server is kind enough (it is s not) to delay notification until you actually ask for them.

    MAPI events are designed for the UI purposes only. For any kind of sync under Exchange, use ICS (Incremental Change Synchronization) API - see PR_CONTENTS_SYNCHRONIZER and IExchangeExportChanges on MSDN.


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


    Friday, June 21, 2013 2:20 PM