event handler problems c#
Posted on 2008-11-10
I am having some trouble keeping an event handle alive for some reason.
My project is an outlook addin which prompts the user to do something when they send an email. Now, I have an event handler hooked up to the Sent Items folder so that when the sent email arrives in that folder it fires the prompt. The reason I have it attached to the sent items folder is so that I can deal with the email after it is sent.
Initially all worked great and then I put it onto a client machine and the event didnt want to fire at all. This is when I attached another event (initially to figure what was happening) to the onSend event. What this did was check to see, via a global flag, if the handle had been placed on the Sent Items folder. If it had not it would create it and switch the flag. The global flag was required so that the handle was not created multiple times every time another email was sent.
I hope this is all making sense!
What is happening now though is in some instances the first few emails will respond how they are supposed to; ie prompt after they have been sent. after this it stops to prompt and i cant figure out why.
I am hopeing that maybe there is a way I can check to see if the event handle exists directly rather than using a global flag, as i dont like this method anyhow. My only other thought is that maybe the handle i have setup is getting cleaned up somehow?
If anyone has any suggestions that help me figure what is going on i would greatly appreciate it.