none
How to capture the Outlook category add/update/delete events? RRS feed

  • Question

  • We can use to AddHandler to capture the ItemAdd event of Notes/Tasks/Contacts/Appointments.

    E.g.:

     AddHandler items.ItemAdd, AddressOf ItemAdded

    However, how can we capture the categories add/modify/delete events?

    Thanks,

    Cowcow 

    Wednesday, August 27, 2014 9:40 AM

Answers

  • Hello Cowcow,

    The ItemAdd event is fired when one or more items are added to the specified collection. Categories are not items. 

    The Categories class doesn't provide any events. However you can check the Categories property of the Namespace or/and Store class using the timer. This property represents the Master Category List, which is the set of Category objects that can be applied to Outlook items contained by the NameSpace object, and applies to all users of that namespace. Thus, you may see whether any categories were added or removed.

    Wednesday, August 27, 2014 9:58 AM
  • Categories are stored in a hidden message with the message class = "IPM.Configuration.CategoryList" in the Calendar folder.
    You can see it in OutlookSpy (go to the Calendar folder, click IMAPIFolder button, go to the "Associated Contents" tab, locate the message with the PR_MESSAGE_CLASS property == "IPM.Configuration.CategoryList", double click on it, locate the PR_ROAMING_XMLSTREAM propertty.

    Outlook allows to open hidden messages (MAPIFolder.GetStorage), but it does not provide access to the hidden items in the same way it exposes the regular MAPIFolder.Items collection.
    If you are using Extended MAPI (C++ or Delphi), you can listen to the events on the asssociated contents table (IMAPITable::Advise) or subscibe to the events on the hidden message by passing its entry id to the IMsgStore::Advise.
    If using Redemption is an option, you can use RDOFolder.HiddenItems collection to trap the events (RDOItems.ItemChange), or you can open the hidden message as RDOMail object and listen to the RDOMail.OnModified event.


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


    Wednesday, August 27, 2014 5:44 PM

All replies

  • Hello Cowcow,

    The ItemAdd event is fired when one or more items are added to the specified collection. Categories are not items. 

    The Categories class doesn't provide any events. However you can check the Categories property of the Namespace or/and Store class using the timer. This property represents the Master Category List, which is the set of Category objects that can be applied to Outlook items contained by the NameSpace object, and applies to all users of that namespace. Thus, you may see whether any categories were added or removed.

    Wednesday, August 27, 2014 9:58 AM
  • Categories are stored in a hidden message with the message class = "IPM.Configuration.CategoryList" in the Calendar folder.
    You can see it in OutlookSpy (go to the Calendar folder, click IMAPIFolder button, go to the "Associated Contents" tab, locate the message with the PR_MESSAGE_CLASS property == "IPM.Configuration.CategoryList", double click on it, locate the PR_ROAMING_XMLSTREAM propertty.

    Outlook allows to open hidden messages (MAPIFolder.GetStorage), but it does not provide access to the hidden items in the same way it exposes the regular MAPIFolder.Items collection.
    If you are using Extended MAPI (C++ or Delphi), you can listen to the events on the asssociated contents table (IMAPITable::Advise) or subscibe to the events on the hidden message by passing its entry id to the IMsgStore::Advise.
    If using Redemption is an option, you can use RDOFolder.HiddenItems collection to trap the events (RDOItems.ItemChange), or you can open the hidden message as RDOMail object and listen to the RDOMail.OnModified event.


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


    Wednesday, August 27, 2014 5:44 PM
  • Categories is a String. You can add it to any selected Item/s using interface or code.

    But you can have a problem to add categories to IMAP items using interface, because MS do not supported:

    Then you should use code to display interface.

    Konto POP
     

     

    Konto IMAP
     

    R


    Oskar Shon, Office System MVP - www.VBATools.pl
    if Helpful; Answer when a problem solved

    Monday, September 1, 2014 6:58 AM