Logic to detect when an attached mail item is opened RRS feed

  • Question

  • What would be the best way (i.e. checking a specific property or other logic/approach) to detect that a user is opening an attached mailitem in an Outlook message? I have a working Outlook Addin that asks users when they click on Reply-All in a mailtem that has more than one recipient if they really want to reply all. It works great except when someone attachs a mail item as an attachment and the user opens it. Since the item.recipients.count > 1 on the attached message, my reply-all code fires. I'm thinking the easiest way to handle this is to somehow detect when a user open a mail item that is attached to an existing message and exclude my code from firing. In looking at the properties of the opened attached mailitem at my breakpoint, I don't see anything that would flag it as an attached mailitem versus just opening a mailitem from an outlook folder.

    Thanks in advance.

    Thursday, March 22, 2012 1:02 AM


  • Firstly, chances are that message will be sent (MailItem.Sent property will be true), and secondly its EntryID property should be empty.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    • Marked as answer by Fajita1973 Sunday, March 25, 2012 12:38 AM
    Thursday, March 22, 2012 2:03 AM

All replies