none
capture mailItem flagStatus change event RRS feed

  • Question

  • Hi All!

    I am building a shared add-in for Outlook 2003 upwards with C#. In it, I now need to do some process when a user changes the flag status of a mail item.

    I have looked into the MailItem.PropertyChange event by getting the selected mail item through Explorer.OnSelectChange. However, on testing I found out that the user can change the flag of a mail OTHER than the currently selected one through the Explorer. Then the Property change event does not fire.

    Is there a way to capture this event for any mail item (such as an Explorer-level event)?

    Thanks!

    Thimila

    Wednesday, April 17, 2013 6:32 AM

Answers

  • Aside from items in an Explorer.Selection, and open items in Inspectors, users can change flag status using a right-click context menu. How and if you can handle that depends on the Outlook version.
     
    For Outlook 2010/2013 you need to handle the context clicks in the scope of the ribbon Explorer object. You may need to repurpose any controls in which you are interested, so you can handle the clicks. See http://msdn.microsoft.com/en-us/library/office/ee861520.aspx for the 2013 object model reference, and http://msdn.microsoft.com/en-us/library/office/ee692172(v=office.14).aspx for information about 2010.
     
    In Outlook 2007 you would handle those clicks using the Application.ItemConextMenuDisplay() event. That provides you with the CommandBar and Selection for the click.
     
    For 2003 the official position is there's no support at all for context menu handling, see http://support.microsoft.com/kb/294223. See http://www.outlookcode.com/codedetail.aspx?id=314 for an unsupported hack for context menu handling for Explorers. For Inspectors just forget it, the hacks I've tried don't work. There's also an ATL/C++ sample that uses the same techniques for context menu handling in 2003 at http://www.codeproject.com/Articles/8016/Developing-an-Office-2003-COM-add-in-with-VC-ATL.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Thimila Fernando" <=?utf-8?B?VGhpbWlsYSBGZXJuYW5kbw==?=> wrote in message news:5d5b3370-d1f1-4f45-b3f1-ab0495348118...

    Hi All!

    I am building a shared add-in for Outlook 2003 upwards with C#. In it, I now need to do some process when a user changes the flag status of a mail item.

    I have looked into the MailItem.PropertyChange event by getting the selected mail item through Explorer.OnSelectChange. However, on testing I found out that the user can change the flag of a mail OTHER than the currently selected one through the Explorer. Then the Property change event does not fire.

    Is there a way to capture this event for any mail item (such as an Explorer-level event)?

    Thanks!

    Thimila


    Ken Slovak MVP - Outlook
    Wednesday, April 17, 2013 3:22 PM
    Moderator

All replies

  • Aside from items in an Explorer.Selection, and open items in Inspectors, users can change flag status using a right-click context menu. How and if you can handle that depends on the Outlook version.
     
    For Outlook 2010/2013 you need to handle the context clicks in the scope of the ribbon Explorer object. You may need to repurpose any controls in which you are interested, so you can handle the clicks. See http://msdn.microsoft.com/en-us/library/office/ee861520.aspx for the 2013 object model reference, and http://msdn.microsoft.com/en-us/library/office/ee692172(v=office.14).aspx for information about 2010.
     
    In Outlook 2007 you would handle those clicks using the Application.ItemConextMenuDisplay() event. That provides you with the CommandBar and Selection for the click.
     
    For 2003 the official position is there's no support at all for context menu handling, see http://support.microsoft.com/kb/294223. See http://www.outlookcode.com/codedetail.aspx?id=314 for an unsupported hack for context menu handling for Explorers. For Inspectors just forget it, the hacks I've tried don't work. There's also an ATL/C++ sample that uses the same techniques for context menu handling in 2003 at http://www.codeproject.com/Articles/8016/Developing-an-Office-2003-COM-add-in-with-VC-ATL.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Thimila Fernando" <=?utf-8?B?VGhpbWlsYSBGZXJuYW5kbw==?=> wrote in message news:5d5b3370-d1f1-4f45-b3f1-ab0495348118...

    Hi All!

    I am building a shared add-in for Outlook 2003 upwards with C#. In it, I now need to do some process when a user changes the flag status of a mail item.

    I have looked into the MailItem.PropertyChange event by getting the selected mail item through Explorer.OnSelectChange. However, on testing I found out that the user can change the flag of a mail OTHER than the currently selected one through the Explorer. Then the Property change event does not fire.

    Is there a way to capture this event for any mail item (such as an Explorer-level event)?

    Thanks!

    Thimila


    Ken Slovak MVP - Outlook
    Wednesday, April 17, 2013 3:22 PM
    Moderator
  • Thanks Ken. Saved me from a hassle! :)
    Thursday, April 18, 2013 1:02 AM