简体   繁体   中英

Is it possible to have two sets of categories in Outlook?

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.

将第一组的类别(与语言相关)命名为l_English,l_German等,将第二组的类别(与类型相关)命名为t_construction等。

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM