A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook add-in multithreading (plus)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 26th 09, 01:33 PM posted to microsoft.public.outlook.program_addins
Steve Gerrard
external usenet poster
 
Posts: 1
Default Outlook add-in multithreading (plus)

Hi,

I'm rather new at this outlook add-in development stuff, and though I've been trying to read as much background as possible before attacking the real thing, I seem to be missing quite a few essential elements, so please point me in the right direction if I'm completely off.

I'm trying to develop an add-in that would enable sending large attachments, much the same way as the yousendit outlook add-in, or its Adobe counterpart.

The first thing for me is trying to select the appropriate technology/framework/API.

I've read all over that the outlook object model has issues with multithreading, and since it's imperative for my add-in that the outlook GUI remains responsive while attachments are being uploaded in the background (before the sent mail item is actually sent or moved to the outbox), multithreading is a must. I've managed to gather some bits and pieces that lead me to believe MAPI could be my friend, but have not managed to find any concrete answer as to whether a MAPI add-in even exists: is it an alternative for the Outlook object model, or simply an additional API that can be used from within a VSTO/COM add-in?

So, my question is: can I use C# VSTO in order to develop an add-in that parses attachments in the background, while outlook remains responsive and functional? If so, is it simply a matter of starting a new background thread? Can you recommend any sample / how-to / open-source code / book that could get me started?

Another question I have, is regarding the events I should trap to perform what I've described above. Ideally, I'd like to parse the message while it's in the outbox, "releasing" it to be sent when I'm done. The thing is, I've tried trapping the ItemSend event, but the mailitem is still open when it fires, and the ItemAdd event does not consistently fire when listening on the outbox folder. I've seen the mentioned add-ins move relevant messages into a different folder when the Send button is clicked, and only when the upload is done the message is moved to the outbox and sent. How can that be accomplished, making the Send button move messages to a folder other than the outbox?

Hope it's not too much for a single post, I've just decided I'd better ask everything I'm missing after a week or so of reading confusing and contradicting material...

Any help would be greatly appreciated.

Thanks,
G..
Submitted using http://www.outlookforums.com
Ads
  #2  
Old May 26th 09, 04:17 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook add-in multithreading (plus)

Extended MAPI cannot be used with any managed code, only with unmanaged code
and only there in C++ or Delphi. It also has a steep learning curve and is
not object oriented.

The Outlook object model can only be used from the main process thread, any
attempts to use it from a background thread will crash or hang Outlook
and/or cause other code running with Outlook to also crash. Not recommended
and not a good idea at all.

You can do all accesses to the object model in the foreground thread and
gather the data as data, then pass that to a background thread for
processing as long as that doesn't use the Outlook object model at all.

I mostly use the item.Send() event, using Application.ItemSend() usually is
too late in the process for what I want to do. Messing with items in the
Outbox after they are submitted to the mail transport will prevent the item
from being sent.

For lots of Outlook code samples and discussions of problems like this go to
www.outlookcode.com

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Steve Gerrard" gerrard171717[at]yahoo[dot]com wrote in message
...
Hi,

I'm rather new at this outlook add-in development stuff, and though I've
been trying to read as much background as possible before attacking the
real thing, I seem to be missing quite a few essential elements, so please
point me in the right direction if I'm completely off.

I'm trying to develop an add-in that would enable sending large
attachments, much the same way as the yousendit outlook add-in, or its
Adobe counterpart.

The first thing for me is trying to select the appropriate
technology/framework/API.

I've read all over that the outlook object model has issues with
multithreading, and since it's imperative for my add-in that the outlook
GUI remains responsive while attachments are being uploaded in the
background (before the sent mail item is actually sent or moved to the
outbox), multithreading is a must. I've managed to gather some bits and
pieces that lead me to believe MAPI could be my friend, but have not
managed to find any concrete answer as to whether a MAPI add-in even
exists: is it an alternative for the Outlook object model, or simply an
additional API that can be used from within a VSTO/COM add-in?

So, my question is: can I use C# VSTO in order to develop an add-in that
parses attachments in the background, while outlook remains responsive and
functional? If so, is it simply a matter of starting a new background
thread? Can you recommend any sample / how-to / open-source code / book
that could get me started?

Another question I have, is regarding the events I should trap to perform
what I've described above. Ideally, I'd like to parse the message while
it's in the outbox, "releasing" it to be sent when I'm done. The thing is,
I've tried trapping the ItemSend event, but the mailitem is still open
when it fires, and the ItemAdd event does not consistently fire when
listening on the outbox folder. I've seen the mentioned add-ins move
relevant messages into a different folder when the Send button is clicked,
and only when the upload is done the message is moved to the outbox and
sent. How can that be accomplished, making the Send button move messages
to a folder other than the outbox?

Hope it's not too much for a single post, I've just decided I'd better ask
everything I'm missing after a week or so of reading confusing and
contradicting material...

Any help would be greatly appreciated.

Thanks,
G.. Submitted using http://www.outlookforums.com


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multithreading Stuart Parker Add-ins for Outlook 5 September 19th 08 06:23 PM
Multithreading with C# Dorian Add-ins for Outlook 15 September 9th 08 07:29 PM


All times are GMT +1. The time now is 12:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.