I'm trying to automate changing a message class in an Outlook form. Here's the problem.
Let's say I create a user-defined field from the All Fields tab in a contact, called IntroLetterSent. I'm using a form with the message class "IPM.Contact.ITU" on a public contacts folder called the "Blue Book". I've set that folder to always post items to that folder using the ITU form.
However, every time I change the value of IntroLetterSent on a contact in this folder, the message class is somehow mysteriously and automatically changed to the standard "IPM.Contact", and the contact item still posts. If you know how to get around this, and have a user-defined field that is not attached to any form post using a specific form and message class, then let me know--that would be the real solution.
But in the meantime, here's what I need to do. I need to put some VBScript in the form (using the "View Code" screen from the Form menu in Form Design View) that will execute probably on close. I'm not familiar enough with code syntax to write this, so I need some help. Here's what I have so far:
One problem is that I don't know exactly on what event the message class is automatically changed in the scenario above. I think it's pretty late. Will "Sub Item_Close" cause the routine to execute once the item is closed? And do all my " Item.* " codes have the correct syntax?
I haven't tried it yet, but in this case I'd rather ask first and then try it.
Thank you in advance.
Christopher
Let's say I create a user-defined field from the All Fields tab in a contact, called IntroLetterSent. I'm using a form with the message class "IPM.Contact.ITU" on a public contacts folder called the "Blue Book". I've set that folder to always post items to that folder using the ITU form.
However, every time I change the value of IntroLetterSent on a contact in this folder, the message class is somehow mysteriously and automatically changed to the standard "IPM.Contact", and the contact item still posts. If you know how to get around this, and have a user-defined field that is not attached to any form post using a specific form and message class, then let me know--that would be the real solution.
But in the meantime, here's what I need to do. I need to put some VBScript in the form (using the "View Code" screen from the Form menu in Form Design View) that will execute probably on close. I'm not familiar enough with code syntax to write this, so I need some help. Here's what I have so far:
Code:
Sub Item_Close
NewMC = "IPM.Contact.ITU"
If Item.MessageClass <> NewMC Then
Item.MessageClass = NewMC
Item.Save
End If
End Sub
One problem is that I don't know exactly on what event the message class is automatically changed in the scenario above. I think it's pretty late. Will "Sub Item_Close" cause the routine to execute once the item is closed? And do all my " Item.* " codes have the correct syntax?
I haven't tried it yet, but in this case I'd rather ask first and then try it.
Thank you in advance.
Christopher