Set Color Category for Outlook Message

Aspose.Email - Set Color Category for Outlook Message

Microsoft Outlook lets users assign color categories to differentiate emails. A color category marks an email as being of some kind of importance or category. Aspose.Email provides the same feature through the FollowUpManager class. The following functionality is supported via this class:

  • AddCategory() takes MapiMessage and the color category string as arguments.
  • removeCategory() takes MapiMessage and the color category string to be removed from the message as arguments.
  • clearCategories() is used to remove all the color categories from the message.
  • getCategories() is used to retrieve all the color categories from a particular message.

Java


 MapiMessage msg = MapiMessage.fromFile(dataDir + "message.msg");

// Add category

FollowUpManager.addCategory(msg, "Purple Category");

// Add another category

FollowUpManager.addCategory(msg, "Red Category");

// Retrieve the list of available categories

IList categories = FollowUpManager.getCategories(msg);

// Remove the specified category

FollowUpManager.removeCategory(msg, "Red Category");

// Clear all categories

//FollowUpManager.clearCategories(msg);

msg.save(dataDir + "AsposeCategories.msg");

Download Running Code

Download Sample Code