Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / January 2004

Tip: Looking for answers? Try searching our database.

Add-In and custom form code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Selgin - 30 Jan 2004 02:41 GMT
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
Sue Mosher [MVP] - 30 Jan 2004 03:29 GMT
You should be using the Item_Open event to make your UI changes, not
Item_Read.
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> 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.
Selgin - 30 Jan 2004 03:51 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.