Using Timer in Outlook with AdxForm

Add-in Express™ Support Service
That's what is more important than anything else

Using Timer in Outlook with AdxForm
 
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi,

my Inspector contains a Outlook Form with Subject, To and Body and a adxForm.
I have to update the adxForm with the current values from Subject and Body.

I realized this with a System.Windows.Forms.Timer. Every 8 seconds I read the current values from Body and Subject and compare them with the last one. If something changed I invoke a method on the adxForm to show the new values. That all is executed in the context of the System.Windows.Forms.Timer Thread.

Sometimes Outlook hangs up in the context of the Timer-Thread. It stands on the code inside the adxForm.

Exists a better way to read periodically the current values from the MailItem?

Thanks
Christian.
Posted 29 Oct, 2012 04:25:19 Top
Andrei Smolin


Add-in Express team


Posts: 16656
Joined: 2006-05-11
Hi Christian,

When you access e.g. Subject, you get its latest saved value, not what is shown in th inspector window. The same applies to Body. That is you can save the message to get latest values of these properties. On the other hand, whenever the item is saved, it generates the Write event; also, for every built-in property modified, the save operation generates the PropertyChange event which is mapped to the ProcessPropertyChange method of the Outlook Item (not Items!) Events class.

Christian Havel writes:
Sometimes Outlook hangs up in the context of the Timer-Thread. It stands on the code inside the adxForm.


I'm sorry, what do you mean by "stands"?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Oct, 2012 05:59:21 Top