none
Implementing a behavior similar to ECE's Complose New Message event in Outlook 2010 RRS feed

  • Question

  • I am trying to implement behavior similar to ECE's Compose New Message event. Got this idea from a reply at this thread http://www.add-in-express.com/forum/read.php?FID=1&TID=6954

    I am catching the NewInspector event and in the event handler for NewInspector i am fetching the current item. On the current item i need to check whether the item is saved . But the problem is outlook crashes when when i try to check the saved status of the item.

    I also get a crash if i try to find entryID.
    What mistake in this implementation and is this approach correct?


    • Edited by sonypix Thursday, August 23, 2012 11:15 AM
    Wednesday, July 18, 2012 6:34 AM

Answers

  • Look at the subject prefix (FW vs RE).

    If you need to distinguish betwen Reply and Reply All, you will need to find the parent message (you can use ConversationIndex for that or start with Application.ActiveExplorer.Selection or Application.Inspectors). Once you have the parent message, you can read teh PR_LAST_VERB property.

    You can also check the number of Recipients in the message (1 vs >1).


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

    Thursday, July 19, 2012 10:42 PM

All replies

  • Do you get an error if you access any other property?

    This sure sounds like you have an item other than MailItem. Instead of hard casting (CComQIPtr<Outlook::_MailItem> pMItem(Item)), have you tried to QueryInterface() to see if you really have a MailItem object?


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

    Wednesday, July 18, 2012 6:51 AM
  • maybe try to follow suggestion that Ken Slovak always repeats - access item's properies only in Inspector's Activate event or later, never before.
    Wednesday, July 18, 2012 12:39 PM
  • When you say you get a "crash" do you mean an Access Violation? Or some other unhandled Exception? Or does the call just return an error code?

    If you're getting an error code, what is it? If it's an exception, what kind of exception is it?

    Thursday, July 19, 2012 3:22 PM
    Answerer
  • Thanks Damian and Stephen for offering help.



    Thursday, July 19, 2012 8:44 PM
  • Look at the subject prefix (FW vs RE).

    If you need to distinguish betwen Reply and Reply All, you will need to find the parent message (you can use ConversationIndex for that or start with Application.ActiveExplorer.Selection or Application.Inspectors). Once you have the parent message, you can read teh PR_LAST_VERB property.

    You can also check the number of Recipients in the message (1 vs >1).


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

    Thursday, July 19, 2012 10:42 PM