none
Outlook Redemption and addins RRS feed

  • Question


  • Hi there! We're a team of developers of addins for MS Outlook and we're facing a problem where "NewMailEx" event does not fire for exchange accounts in not cached mode. What are we trying to achieve is autosave all new items efficiently without overload to outlook thread.

    We were looking through some articles (here is one of them https://www.add-in-express.com/creating-addins-blog/2011/10/03/outlook-newmail-event/) and decided to implement new emails detection based on known and current lists comparison but faced slow enumeration for offline mode.

    So we wanted to ask you guys if anybody can advise us whether Outlook Redemption RDOSession.OnNewMail(EntryID) will work in non-cached case or we have to find another way.

    If this event is not suitable for that case may be anybody can tell us if Outlook Redemption items enumeration is faster than original Outlook's one?

    Best regards,
    Actonica studio
    Wednesday, May 25, 2016 8:40 AM

Answers

  • Based on your email, what you are trying to do is process messages that arrived while Outlook was not running. In that case NewMailEx will not fire since the message has already been received by the Exchange server while your code was not running.

    Your best bet is to simply read all unread messages in the Inbox on startup using Items.Restrict or Items,Find/FindNext.
    Or better yet, use Incremental Change Synchronization API: http://www.dimastr.com/redemption/rdofoldersynchronizer.htm


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

    Thursday, May 26, 2016 12:22 AM
  • Hello Sergey,

    The OnNewMail event from the Redmeption library corresponds to the fnevNewMail notification, see MAPI Notification Events for more information.

    If you use Exchange Server in a profile you may encounter situations in which you don’t get a needed event notification such as OnNewMail. The reasons may be:

     - The component connects to the MAPI subsystem after the first synchronization between Outlook and Exchange (i.e. when Outlook loads). That is, you will not get notifications for all e-mails that were received before the component initialize subroutine. To solve this problem you can try to use Exchange Client Extensions. You can read more in an article in MSDN.
     - You close Outlook before event notification arrived and that is why you do not get it anymore. To resolve this issue you have to track all items and check by timer for new items. For instance, you can use ReceivedTime or set user properties on arrived emails and is this way you can recognize old and new ones. Certainly you can choose your own way of tracking new emails.

    My experience shows that for Exchange server profiles, an event notification may delay for an on an arbitrary period. Some developers mistakenly reported that event notification didn’t work with Exchange server. In fact, they missed event notifications when closing Outlook immediately after the event had occurred. Read more about that in the Handling NewMail, NewMailEx and ItemAdd Outlook events in .NET article.

    Note, you can use Extended MAPI on another threads, so you can check out the list of existing and new emails on a secondary thread leaving Outlook UI free. Redemption supports that.


    [custom.development]


    Wednesday, May 25, 2016 1:50 PM

All replies

  • Hello Sergey,

    The OnNewMail event from the Redmeption library corresponds to the fnevNewMail notification, see MAPI Notification Events for more information.

    If you use Exchange Server in a profile you may encounter situations in which you don’t get a needed event notification such as OnNewMail. The reasons may be:

     - The component connects to the MAPI subsystem after the first synchronization between Outlook and Exchange (i.e. when Outlook loads). That is, you will not get notifications for all e-mails that were received before the component initialize subroutine. To solve this problem you can try to use Exchange Client Extensions. You can read more in an article in MSDN.
     - You close Outlook before event notification arrived and that is why you do not get it anymore. To resolve this issue you have to track all items and check by timer for new items. For instance, you can use ReceivedTime or set user properties on arrived emails and is this way you can recognize old and new ones. Certainly you can choose your own way of tracking new emails.

    My experience shows that for Exchange server profiles, an event notification may delay for an on an arbitrary period. Some developers mistakenly reported that event notification didn’t work with Exchange server. In fact, they missed event notifications when closing Outlook immediately after the event had occurred. Read more about that in the Handling NewMail, NewMailEx and ItemAdd Outlook events in .NET article.

    Note, you can use Extended MAPI on another threads, so you can check out the list of existing and new emails on a secondary thread leaving Outlook UI free. Redemption supports that.


    [custom.development]


    Wednesday, May 25, 2016 1:50 PM
  • Based on your email, what you are trying to do is process messages that arrived while Outlook was not running. In that case NewMailEx will not fire since the message has already been received by the Exchange server while your code was not running.

    Your best bet is to simply read all unread messages in the Inbox on startup using Items.Restrict or Items,Find/FindNext.
    Or better yet, use Incremental Change Synchronization API: http://www.dimastr.com/redemption/rdofoldersynchronizer.htm


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

    Thursday, May 26, 2016 12:22 AM
  • >>>"NewMailEx" event does not fire for exchange accounts in not cached mode.

    According to your description, for users with an Exchange Server account (non-Cached Exchange Mode or Cached Exchange Mode), the event will fire only for messages that arrive at the server after Outlook has started. The event will not fire for messages that are synchronized in Cached Exchange Mode immediately after Outlook starts, nor for messages that are already on the server when Outlook starts in non-Cached Exchange Mode. If you have any feedbacks for Outlook, please feel free to submit them to User Voice:

    https://outlook.uservoice.com/

    For more information, click here to refer about Application.NewMailEx Event (Outlook)

    >>>If this event is not suitable for that case may be anybody can tell us if Outlook Redemption items enumeration is faster than original Outlook's one?

    Since this forum is for Developer discussions and questions involving Microsoft Outlook, like developing issues related with Outlook Object model, vbs related with Outlook Object model, if you have any issue with Outlook Redemption, you could post them on Outlook Redemption FAQ to seek help.

    Thanks for your understanding.

    Friday, May 27, 2016 6:58 AM
  • To solve this problem you can try to use Exchange Client Extensions. You can read more in an article in MSDN.

    I thought ECEs were killed off several years ago with Outlook 2010?

    https://blogs.msdn.microsoft.com/stephen_griffin/2009/05/04/exchange-client-extension-dead-in-outlook-2010/


    • Edited by RLWA32 Friday, May 27, 2016 11:45 AM
    • Proposed as answer by David_JunFeng Sunday, June 5, 2016 3:23 PM
    Friday, May 27, 2016 11:44 AM
  • Looks so. I didn't play with them starting from Outlook 2007.

    [custom.development]

    Sunday, May 29, 2016 7:49 PM