Add-In and custom form code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I developed a COM-Addin in Outlook 2000 that sets the value of a user-defined field in a custom email form in the inbox item_add event ie. when the email arrives

In the custom form itself, in the Item_Read event, I have vbscript code that reads the value of this custom field set by add-in, and formats some labels in the read form (bold etc..) accordingly

The problem I am having is that the first time the message is opened by the user, the formatting logic in the form code doesn't execute properly. However, on subsequent openings it works fine.

In my testing I have come to the conclude that since the Item_Read event is triggered when a message arrives, and not just when selected or opened, at this point the add-in hasn't yet had time to do its job (set the custom value), thus causing the form code to read nothing in the custom fields value. But when opening the form a second and subsequent times, the value is there and code is executed correcly

My question is, is there a way around this? My understanding is that I cannot do the label formatting in the add-in itself because Outlook will refer to the published forms definition when opening the form, tus it won't be permanent formatting for each email

Or is it simply how Outlook works and thats it? Hope I was clear

Thanks

Selgin
 
You should be using the Item_Open event to make your UI changes, not
Item_Read.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Selgin said:
Hi,

I developed a COM-Addin in Outlook 2000 that sets the value of a
user-defined field in a custom email form in the inbox item_add event ie.
when the email arrives.
In the custom form itself, in the Item_Read event, I have vbscript code
that reads the value of this custom field set by add-in, and formats some
labels in the read form (bold etc..) accordingly.
The problem I am having is that the first time the message is opened by
the user, the formatting logic in the form code doesn't execute properly.
However, on subsequent openings it works fine.
In my testing I have come to the conclude that since the Item_Read event
is triggered when a message arrives, and not just when selected or opened,
at this point the add-in hasn't yet had time to do its job (set the custom
value), thus causing the form code to read nothing in the custom fields
value. But when opening the form a second and subsequent times, the value is
there and code is executed correcly.
My question is, is there a way around this? My understanding is that I
cannot do the label formatting in the add-in itself because Outlook will
refer to the published forms definition when opening the form, tus it won't
be permanent formatting for each email.
 
Did the trick nicely, thank you Sue

----- Sue Mosher [MVP] wrote: ----

You should be using the Item_Open event to make your UI changes, no
Item_Read
--
Sue Mosher, Outlook MV
Author o
Microsoft Outlook Programming - Jumpstart fo
Administrators, Power Users, and Developer
http://www.outlookcode.com/jumpstart.asp
 
Back
Top