Adding Category to an Email programmatically

H

hepadmin

Hi,

just trying to create some code that responds to a Msgbox prompt when
the Outlook ItemSend event is fired.

My code is below and it all works fine except for the piece where I try
to assign a category to the email. If a user chooses Yes in the
msgbox, I want the email to be forwarded to the Records department(this
works) and for the email to be assigned a category of registered(this
doesn't).

Any help appreciated with this seemingly simple task.

Cheers,



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim str1 As String
Dim str2 As String
Dim myvar

str1 = "Would you like to register this email?"
str2 = "Records Management"

myvar = MsgBox(str1, vbYesNo, str2)

If myvar = 6 Then

Item.Categories = "Registered"
Item.Save

Set myRecip = Item.Recipients.Add("(e-mail address removed)")
myRecip.Type = olBCC
Item.Recipients.ResolveAll

End If

End Sub
 
H

hepadmin

Sorry,

I need to correct the below. I need to be able to make the Categories
that are added in this process appear at the receiver's end. The below
code only affects the categories of the item on the local machine, ie.
in the Sent Items folder.

Any ideas?

Cheers,
 

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