[Outlook2007] Background attachment processing

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

[Outlook2007] Background attachment processing
How not to block outlook while processing the mail to send 
Christophe Delhorbe




Posts: 4
Joined: 2008-09-24
Hi,

Let's say we have a plugin that transforms the attachment of mails when they are sent.
We have hooked the code on the itemSend event and everything works fine when the attachment is small.
We have a WPF modal dialog box to show the progress of the processing and once again, this works fine.
But when the attachment gets bigger, the processing time gets longer and everything is not so fine any longer.
As we have a modal dialog box, it seems that all Outlook waits for it to finish, no button responds to the user actions.

Is there an easy way to block the sending of the mail while we process it, and not block the rest of Outlook? Shall we use another event, or prevent outlook from sending the mail and sending it ourself when we're ready to do so (cancel the mail in itemSend, store it somewhere, process the attachement, send)?

Thanks for your help,
Christophe
Posted 24 Sep, 2008 11:29:18 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Christophe,

Outlook is not a thread safe application. So we don't recommend to run any secondary threads in Outlook.
.NET, Extended MAPI, Windows Phone & RT
Posted 24 Sep, 2008 17:12:15 Top
Christophe Delhorbe




Posts: 4
Joined: 2008-09-24
Hi Eugeune,

I thought that I could use Outlook in a mutlithreaded manner as long as I was careful. Indeed WPF or Swing are not thread safe, that doesn't mean I can't have other thread do other things. But if you say so...

Anyway, since I can read an email while I'm receiving or sending some other ones, I thought there could be a way to proceed my attachments whithout preventing the user to read his other mails.

Best regards,
Christophe
Posted 25 Sep, 2008 07:09:30 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Christophe,

We don't recommend to run any secondary threads in Outlook if you interfere with the Outlook Object Model.
.NET, Extended MAPI, Windows Phone & RT
Posted 25 Sep, 2008 08:05:27 Top