none
How to get a MailItem when sending/receiving mail message? RRS feed

Answers

  • NewMailEx event passes the list of new messages' entry ids to the event handler.

    Items.ItemAdd event passes the new item to the event handler.

    What is your code that sets up the event handlers?


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

    • Marked as answer by Eranyang Tuesday, June 19, 2012 6:44 AM
    Tuesday, June 19, 2012 4:46 AM
  • The method signature it wrong - it takes a single parameter - Item of type object.

    NewMailEx event takes a single parameter (EntryIDCollection) of type String, which is a CR/LF separated list of entry ids.


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

    • Marked as answer by Eranyang Tuesday, June 19, 2012 6:44 AM
    Tuesday, June 19, 2012 5:33 AM
  • That article is misleading, and will be corrected.
     
    I verified with the product group that the NewMailEx() event fires for Outlook 2010 and later for each item that comes in.
     
    The argument is now a single EntryID, as opposed to a comma delimited array. The sample code would just end up with an array of 1 dimension and one value when the unnecessary Split() was called.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Eranyang" <=?utf-8?B?RXJhbnlhbmc=?=> wrote in message news:38829dec-c55b-4e6f-9bdf-3291fe41eb67...

    By the way, I found that the parameter EntryIDCollection of the NewMailEx event is separated by character ",", not CR/LF

    Please refer to http://msdn.microsoft.com/en-us/library/ff863686.aspx



    Ken Slovak MVP - Outlook
    • Marked as answer by Eranyang Wednesday, June 20, 2012 2:08 AM
    Tuesday, June 19, 2012 8:30 PM
    Moderator

All replies

  • NewMailEx event passes the list of new messages' entry ids to the event handler.

    Items.ItemAdd event passes the new item to the event handler.

    What is your code that sets up the event handlers?


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

    • Marked as answer by Eranyang Tuesday, June 19, 2012 6:44 AM
    Tuesday, June 19, 2012 4:46 AM
  • Thanks for your reply, Dmitry.

    I'm now using methods like this:

    Private Sub inboxItems_ItemAdd() Handles inboxItems.ItemAdd
            mailItemProcess(inboxItems.GetLast())
    End Sub

    I just don't know how to get those reference that an event passes, I'm not familiar with mechanisms of event-driven language.

    Could you please give me a simple line about it?

    Tuesday, June 19, 2012 5:03 AM
  • The method signature it wrong - it takes a single parameter - Item of type object.

    NewMailEx event takes a single parameter (EntryIDCollection) of type String, which is a CR/LF separated list of entry ids.


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

    • Marked as answer by Eranyang Tuesday, June 19, 2012 6:44 AM
    Tuesday, June 19, 2012 5:33 AM
  • Best thanks for you!

    Now I know there is event argument and how to use it.

    However I'm encountering another problem with my add-in, I've posted another question, could you please check it and help me a little more? I really appreciate your kindly help.

    Here's the link: http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/bfec4bef-e92c-4452-a427-63bc01be8158

    Tuesday, June 19, 2012 7:04 AM
  • By the way, I found that the parameter EntryIDCollection of the NewMailEx event is separated by character ",", not CR/LF

    Please refer to http://msdn.microsoft.com/en-us/library/ff863686.aspx


    • Edited by Eranyang Tuesday, June 19, 2012 8:16 AM
    • Marked as answer by Eranyang Tuesday, June 19, 2012 8:16 AM
    • Unmarked as answer by Eranyang Wednesday, June 20, 2012 1:19 AM
    Tuesday, June 19, 2012 8:16 AM
  • That article is misleading, and will be corrected.
     
    I verified with the product group that the NewMailEx() event fires for Outlook 2010 and later for each item that comes in.
     
    The argument is now a single EntryID, as opposed to a comma delimited array. The sample code would just end up with an array of 1 dimension and one value when the unnecessary Split() was called.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Eranyang" <=?utf-8?B?RXJhbnlhbmc=?=> wrote in message news:38829dec-c55b-4e6f-9bdf-3291fe41eb67...

    By the way, I found that the parameter EntryIDCollection of the NewMailEx event is separated by character ",", not CR/LF

    Please refer to http://msdn.microsoft.com/en-us/library/ff863686.aspx



    Ken Slovak MVP - Outlook
    • Marked as answer by Eranyang Wednesday, June 20, 2012 2:08 AM
    Tuesday, June 19, 2012 8:30 PM
    Moderator
  • Best thanks for both of you, Dmitry and Ken.

    It is a single EntryID.

    Wednesday, June 20, 2012 2:24 AM