O
Odd Spot
I have an add-in that listens for a SelectionChange event on any active
explorer. I then add a category to each MailItem in the selection by
using the following code:
String newCat = "New Category";
Selection s = application.ActiveExplorer().Selection;
foreach( MailItem selectedItem in s ){
String cats = selectedItem.Categories;
if (cats == null || cats.Length == 0)
selectedItem.Categories = newCat;
else if (cats.IndexOf(node.RelativePath) == -1)
selectedItem.Categories += "," + newCat;
}
Once this is done the Categories property shows the new category, but,
on all but the first mail item in the selection, the categories list
accessed from Outlook does not display the new category and a search
folder that is searching for the new category will not find any of the
emails but the first. Furthermore, when Outlook is restarted only the
first email will continue to have the category, even in the Category
property.
Any ideas about what is going on here? Is there a better way to add or
remove a property then via the Categories property?
explorer. I then add a category to each MailItem in the selection by
using the following code:
String newCat = "New Category";
Selection s = application.ActiveExplorer().Selection;
foreach( MailItem selectedItem in s ){
String cats = selectedItem.Categories;
if (cats == null || cats.Length == 0)
selectedItem.Categories = newCat;
else if (cats.IndexOf(node.RelativePath) == -1)
selectedItem.Categories += "," + newCat;
}
Once this is done the Categories property shows the new category, but,
on all but the first mail item in the selection, the categories list
accessed from Outlook does not display the new category and a search
folder that is searching for the new category will not find any of the
emails but the first. Furthermore, when Outlook is restarted only the
first email will continue to have the category, even in the Category
property.
Any ideas about what is going on here? Is there a better way to add or
remove a property then via the Categories property?