Is it possible to have two sets of categories in Outlook? Like one set of categories are languages which will include 5 languages and second set would be product type. I need to assign language category and product type category to each email.
If it is not possible to have two sets of category, I would like to put all categories to one set but would only like call them separately in combo box.
Like.
Outlook.Application application = new Microsoft.Office.Interop.Outlook.Application();
Outlook.Folder folder = application.ActiveExplorer().CurrentFolder as Outlook.Folder;
Outlook.Store store = folder.Store;
Outlook.Categories categories = store.Categories;
foreach (Outlook.Category category in categories)
{
if (category != null)
{
ComboBox1.Items.Add(category.Name);
}
else
{
MessageBox.Show("There are no categories.");
}
}
Is it possible to populate above combo box with only language categories? May be by adding where condition.
I know there is way to do it with user defined properties but wondering if I can achieve this using categories.
Thank you.
I follow Victor's suggestion and added same prefix to each category sets. Here is what worked for me, if someone looking for exact answer.
foreach (var category in categories
.Cast<Outlook.Category>()
.Where(c => c.Name.Contains("l_")))
{
// do something here
}