public static void RemoveCategory(this MailItem item, Category category) { List <string> categories = CategoryParser.ConvertToList(item.Categories); if (categories.Contains(category.Name)) { categories.Remove(category.Name); } item.Categories = CategoryParser.ConvertToString(categories); }
public static void AddCategory(this MailItem item, string category) { List <string> categories = CategoryParser.ConvertToList(item.Categories); if (!categories.Contains(category)) { categories.Add(category); } item.Categories = CategoryParser.ConvertToString(categories); }