为 Outlook 消息设置颜色分类

Aspose.Email - 为 Outlook 邮件设置颜色分类

Microsoft Outlook 允许用户为邮件分配颜色分类,以区分不同的重要性或类别。Aspose.Email 通过 FollowUpManager 类。此类支持以下功能:

  • AddCategory() 接受 MapiMessage 以及颜色分类字符串作为参数。
  • removeCategory() 接受 MapiMessage 和要从邮件中移除的颜色分类字符串作为参数。
  • clearCategories() 用于移除邮件中的所有颜色分类。
  • getCategories() 用于检索特定邮件中的所有颜色分类。

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");

下载运行代码

下载示例代码