是否可以在 Outlook 中设置两组类别?
Is it possible to have two sets of categories in Outlook?
是否可以在 Outlook 中设置两组类别?
就像一组类别是语言,它将包括 5 种语言和
第二组是产品类型。我需要为每封电子邮件分配语言类别和产品类型类别。
如果不可能有两组类别,我想将所有类别都放在一组中,但只想在组合框中单独调用它们。
喜欢。
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.");
}
}
是否可以只用语言类别填充上面的组合框?可能是通过添加 where 条件。
我知道可以使用用户定义的属性来实现,但想知道是否可以使用类别来实现。
谢谢。
将第一组的类别(与语言相关)命名为 l_English、l_German 等,将第二组的类别(与类型相关)命名为 t_construction 等
我听从了 Victor 的建议,为每个类别集添加了相同的前缀。如果有人正在寻找确切的答案,这对我有用。
foreach (var category in categories
.Cast<Outlook.Category>()
.Where(c => c.Name.Contains("l_")))
{
// do something here
}
是否可以在 Outlook 中设置两组类别? 就像一组类别是语言,它将包括 5 种语言和 第二组是产品类型。我需要为每封电子邮件分配语言类别和产品类型类别。
如果不可能有两组类别,我想将所有类别都放在一组中,但只想在组合框中单独调用它们。
喜欢。
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.");
}
}
是否可以只用语言类别填充上面的组合框?可能是通过添加 where 条件。
我知道可以使用用户定义的属性来实现,但想知道是否可以使用类别来实现。
谢谢。
将第一组的类别(与语言相关)命名为 l_English、l_German 等,将第二组的类别(与类型相关)命名为 t_construction 等
我听从了 Victor 的建议,为每个类别集添加了相同的前缀。如果有人正在寻找确切的答案,这对我有用。
foreach (var category in categories
.Cast<Outlook.Category>()
.Where(c => c.Name.Contains("l_")))
{
// do something here
}