Browse our Products

Aspose.Email for CPP 24.10 Release Notes

Aspose.Email for C++ 24.10 is based on Aspose.Email for .NET 24.9.

Aspose.Email for C++ does not support asyncronic features of e-mail protocols

New Features

Retrieve Color of Item Category from PST Files

This new feature allows users to retrieve the color associated with categories in PST files. Users can now obtain a list of categories with their respective names and colors and associate them with individual PST items.

Changes in Public API

  • New enum: OutlookCategoryColor
  • New class: PstItemCategory
  • New method in PersonalStorage class: List<PstItemCategory> GetCategories()

Code Examples

Retrieve available categories fronm PST:

auto pst = PersonalStorage::FromFile(u"mailbox.pst")

auto categories = pst->GetCategories();
    
for (auto category : System::IterateOver(categories))
{
       Console::WriteLine(category);
}

Matching a category name with its color:

auto pst = PersonalStorage::FromFile(u"mailbox.pst")

// Get all categories from the PST
auto availableCategories = pst->GetCategories();

// Extract a message from the PST and retrieve the list of category names for the message
auto messageCategoryList = FollowUpManager::GetCategories(pst->ExtractMessage(messageInfo));

// Iterate through each category in the message and match it with the PST category list
for (auto messageCategory : System::IterateOver(messageCategoryList))
{
  SharedPtr<PstItemCategory> category;
  for (auto c : IterateOver(availableCategories))
  {
    if (c->get_Name()->Equals(messageCategory, StringComparison::OrdinalIgnoreCase))
    {
        category = c;
    }
  }
  
  if (category)
  {
      // Print the category name and its associated color
      Console::WriteLine(category);
  }
  else
  {
      Console::WriteLine(String::FormatStr(u"Category: {0}, Color: Not found", messageCategory));
  }
}

The full code of the examples can be found at Aspose Email for C++ GitHub examples repository.