Programmatically assigning categories

G

Guest

Hi Guys,

Outlook 2003, VBA Code:
I'm programmatically assigning categories to email messages (e.g.
objMail.Categories = "My Category"). All very well, but when I have my
emails arranged by Category, the location of the email in the Explorer does
not always match up its Category. Is there a way to refresh the sort when a
category changes. This area of functionality seems a little "flakey".

Your help is greatly appreciated.

Rob Levy
 
G

Guest

Hello again,

a small update to my problem:

When I assign a Category programmatically (through objMail.Categories =
"MyCategory" as before), the explorer doesn't catch on to the fact that the
category has changed until I right-click and do Categories...

The category I assigned programmatically is there in the list and is ticked,
and it's only when I ok this dialog that the explorer finally re-organises
itself and the email is grouped by the correct category.

Is there a way to programmatically force this to happen?

Your input is appreciated as always.

Rob
 
S

Sue Mosher [MVP-Outlook]

Maybe a dumb question, but are you also including an objMail.Save statement?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Hi Sue,

I'm not doing a .Save anywhere in my code. Do you think that including one
after my category assignment would encourage the explorer to re-group by
category?

Mit freundlichen Grüßen
Rob
 
S

Sue Mosher [MVP-Outlook]

Yes. Unless you save the item, the changes are not permanent.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RobL said:
Hi Sue,

I'm not doing a .Save anywhere in my code. Do you think that including one
after my category assignment would encourage the explorer to re-group by
category?

Mit freundlichen Grüßen
Rob
 
G

Guest

Can you guys tell me how to implement this?

I have several categories and would like emails that are sent regarding
specific events:

Such as an email sent with the word "Netapp" to automatically be assinged
netapp upgrade category.

How can a programatically setup categories in this manner?

Please include step by step instructions as I am new to outlook programming
and don't know exactly how to edit the code but, have done similar things in
thep ast with previous verisons of outlook.

I appreciate the help.



RobL said:
Well Sue,

you're a genius! I really appreciate your help.

Cheers,
Rob
 
M

Michael Bauer [MVP - Outlook]

The event you're looking for is the ItemSend event. Please look into the VBA
help for a sample.

Depending on your needs, you might search for 'netapp' in the item's subject
or body property. For that use the Instr function, which returns a value > 0
if the string is found.

Then add a specific category to the item's Categories property. before that,
check if it already contains a value. If so, then add the new value with a
leading semicolon - else you would overwrite the existing category.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Wed, 12 Sep 2007 09:56:03 -0700 schrieb Jody:
 
K

Keith

Is there a place where one can see an example of how to process incoming
mail, and assigning categories based on email address? I've hit the limit on
rules in the wizard and the exchange server now hates me. I'm looking to
expand my options through using VBA. I'm a relative newbie, and need
something that provides examples.

thanks in advance for anything you can offer!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top