locked
How can I get the Action when I assign a category to a mailItem? RRS feed

  • Question

  • hi 

    When I assigned a category to a mailItem, how can I get this action. I want to do sth. when I assigned categories, for example a msgbox show or some other action.

    Thanks.

    Thursday, January 5, 2012 3:38 AM

Answers

  • Hello,

    The event handler provides the name of the property that is being changed. Also note, this event occurs when you save the item, not when you change the categories. If this is NOT what you need, then you'll probably have to deal with intercepting clicking on built-in controls. And this raises the question: what Outlook verions do you need to support?


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader
    Thursday, January 5, 2012 5:36 AM
  • try to invoke Save on MailItem after you remove categories.
    • Marked as answer by William Z Thursday, February 2, 2012 12:30 AM
    Monday, January 30, 2012 1:27 PM

All replies

  • Ok, I got the function that 

    mailItem.PropertyChange += new Outlook.ItemEvents_10_PropertyChangeEventHandler(this.mailItem_PropertyChange);

    may solve this. But When I change the categories of mailItem, this function be called several times, why this happened? I just want to it be called once when I change the categories.

    Thanks.

    Thursday, January 5, 2012 4:10 AM
  • Hello,

    The event handler provides the name of the property that is being changed. Also note, this event occurs when you save the item, not when you change the categories. If this is NOT what you need, then you'll probably have to deal with intercepting clicking on built-in controls. And this raises the question: what Outlook verions do you need to support?


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader
    Thursday, January 5, 2012 5:36 AM
  • My Outlook is 2010
    Friday, January 20, 2012 1:21 AM
  • Can you please describe the scenario in which you want to get notified of this?
    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.
    Friday, January 20, 2012 3:33 PM
  • I want to do some database action when I change one mail's categories or flag status. The breakpoint shows me when I click to change mail's categories or flag, mailItem_PropertyChange be called many times.

     

    And I also get a new trouble:

    When I set the categories of one mail of a conversation, I want to the other mails' categories changed of this conversation.

    For example, I have a conversation with 2 mails: M1 and M2

    M1 with 2 Categories: C1 and C2

    M2 only with C1.

    When I remove C1 in M2, I want C1 in M1 removed automatically. Lucky, I achieved this function. BUT M1 didn't refresh. In other words, it still showed C1 and C2 unless it showed correctly when I click M1. The same situation also happened with the FlagRequest.

    My Outlook version is 2010, and VS version is 2010.How can I do? 

    and I found that when I ask a new question, I can not focus VSTO forum. There was only VS 2010, no VSTO.

    Thank you:)

    Saturday, January 21, 2012 1:53 AM
  • Can anybody help me on above? 

    Thanks:)

    Sunday, January 29, 2012 1:01 AM
  • try to invoke Save on MailItem after you remove categories.
    • Marked as answer by William Z Thursday, February 2, 2012 12:30 AM
    Monday, January 30, 2012 1:27 PM
  • hi Damian, I tried Save() method, but it didn't work.
    Tuesday, January 31, 2012 7:50 AM
  • when you double click to open M1 in new window, does it show updated (proper) categories? Or does it still display those that you removed?
    Tuesday, January 31, 2012 8:40 AM
  • hi Damian, sorry for late reply:)

    You were right, it is the save() function, I lost one in a condition.

    Thank you very much.

     

    Thursday, February 2, 2012 12:30 AM