P
pete
Hi,
I'm writing an Outlook addin in C# which modifies the attachments of an
email. I have hooked the ItemSend event on the application object, and
am spawning a new thread when an email is attempted to be sent. This
thread is passed the Outlook.MailItem object, but i've noticed that if
i access this object from the background thread then this can cause
issues.
If an Outlook email window is spawned using the "mailto:" command, the
addin is loaded etc but the OUTLOOK.EXE process doesn't terminate after
the email is sent and if I try to open outlook afterwards i get a
messagebox with the message "Operation failed". This is resolved by
terminating the rouge outlook process.
Through testing i've discovered this only happens when i touch the
Outlook.MailItem from the other thread. How can I safely access the
mailitem object from another thread?
I'm writing an Outlook addin in C# which modifies the attachments of an
email. I have hooked the ItemSend event on the application object, and
am spawning a new thread when an email is attempted to be sent. This
thread is passed the Outlook.MailItem object, but i've noticed that if
i access this object from the background thread then this can cause
issues.
If an Outlook email window is spawned using the "mailto:" command, the
addin is loaded etc but the OUTLOOK.EXE process doesn't terminate after
the email is sent and if I try to open outlook afterwards i get a
messagebox with the message "Operation failed". This is resolved by
terminating the rouge outlook process.
Through testing i've discovered this only happens when i touch the
Outlook.MailItem from the other thread. How can I safely access the
mailitem object from another thread?