G
gbonawitz
I use categories to sort emails (and rules to automatically assign
categories to incoming email), and have custom search folders to
display emails from each category. For those emails that I haven't
assigned a category yet, I have a search folder that looks for emails
with no category. This works great...unless other people have rules on
outgoing email to assign categories that I don't have.
Unfortunately, I can't create a search folder who's filter is "Category
<> my_category 1 OR my_category2", etc. So, I want to create a
script-driven rule that first removes all categories on incoming email,
then I can let my other rules run to assign my categories.
I am an absolute Outlook macro beginner, but cobbled together the
following code from samples in this group and other websites...
(this is just test code to see if I can manipulate the categories
correctly)
Sub test2(Item As Outlook.MailItem)
MsgBox "Mail message arrived: " & Item.Subject
Item.Categories = "Greg"
Item.Save
End Sub
I have a rule to run this script first on every incoming email.
However, it doesn't appear to work - I don't even get the msgBox (a
test line), let along the test category assignment. Can someone help?
Thanks
categories to incoming email), and have custom search folders to
display emails from each category. For those emails that I haven't
assigned a category yet, I have a search folder that looks for emails
with no category. This works great...unless other people have rules on
outgoing email to assign categories that I don't have.
Unfortunately, I can't create a search folder who's filter is "Category
<> my_category 1 OR my_category2", etc. So, I want to create a
script-driven rule that first removes all categories on incoming email,
then I can let my other rules run to assign my categories.
I am an absolute Outlook macro beginner, but cobbled together the
following code from samples in this group and other websites...
(this is just test code to see if I can manipulate the categories
correctly)
Sub test2(Item As Outlook.MailItem)
MsgBox "Mail message arrived: " & Item.Subject
Item.Categories = "Greg"
Item.Save
End Sub
I have a rule to run this script first on every incoming email.
However, it doesn't appear to work - I don't even get the msgBox (a
test line), let along the test category assignment. Can someone help?
Thanks