Outlook add-in multithreading (plus)

Status
Not open for further replies.
S

Steve Gerrard

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..
 
K

Ken Slovak - [MVP - Outlook]

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

"Steve Gerrard" <gerrard171717[at]yahoo[dot]com> wrote in message

news:eX9tF5f3JHA.4416@TK2MSFTNGP05.phx.gbl...
> 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..
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A "Get Add-Ins" - Which Version of Outlook to use Using Outlook 1
C Looking for feedback on new Outlook Add-in Using Outlook 0
G How to add a folder shortcut to outlook quick access toolbar? Using Outlook 6
G Add to Outlook Contacts - Point to non-default contacts folder Using Outlook 0
O Outlook tasks - Add text column with multiple lines Using Outlook 3
D Add date next to day name in Outlook Today calendar view Using Outlook 1
D iCloud Add-in not working in Outlook 2013 and Outlook 2016 After Windows Upgrade & iCloud Upgrade Using Outlook 2
L Tired of Outlook disabling Adobe PDF Creator add-in Using Outlook 1
Mark Foley Cannot enable add-in in outlook 2010 Using Outlook 0
iwshim outlook 2013 - I cannot see the "Manage Add-ins" Using Outlook 2
A Add to Outlook Contacts from email - default view Outlook VBA and Custom Forms 1
P Add a contact to the New Task in Outlook 2016 Using Outlook 2
O Outlook on Android - add BCC Using Outlook 2
J Execute Add-In Button from VBA Outlook 2016 Outlook VBA and Custom Forms 1
J vb to c# for Outlook add-in. Using Outlook 0
R Outlook add-in to create new contact from an email. Using Outlook 0
A add birthday to outlook contacts Using Outlook 1
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
C Need VBA code to automatically save message outside outlook and add date Outlook VBA and Custom Forms 1
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
O Outlook 2016 follow-up flags--how can I add dates? Using Outlook 1
J VB6 Add-in fails to load in Outlook 16 - message useless Outlook VBA and Custom Forms 4
Diane Poremsky Disable Outlook Add-ins (Apps) New Slipstick.com Articles 0
Diane Poremsky The Best Outlook Store Add-ins Contest New Slipstick.com Articles 0
Diane Poremsky Add to Outlook Contacts Bug (Fixed) New Slipstick.com Articles 1
Diane Poremsky Add a Charm to Outlook Meetings New Slipstick.com Articles 0
N Get the seconds with userproperties.add method VBA Outlook Outlook VBA and Custom Forms 4
D Outlook Add-on for Exchange Spam Management? Exchange Server Administration 2
O Add private notes or comments to Outlook meeting invite Using Outlook 4
J Outlook calendar...How to add an event or appointment without a border around it? Using Outlook 9
iwshim Can I add an Unsubscribe link to Outlook outgoing email? Something like this? Using Outlook 1
Mark Klaassen HOw to keep Outlook iCloud add-in enabled Using Outlook 4
Tech Checkers Make Outlook add Contact Card Address in Location Field based on Appointment Subject Name. Using Outlook 2
B No email accounts in outlook. Cannot add email Using Outlook 5
A iCloud add-on for Outlook: Reminder for new appointment is set to 'None' by default. How to change? Using Outlook 6
T Cannot successfully add gmail IMAP account to Outlook 2013. Using Outlook 1
D Preventing users to disable an Outlook Add-in Using Outlook.com accounts in Outlook 5
K VBScript Outlook, add attachment Outlook VBA and Custom Forms 1
iwshim mail merge and add the contact picture outlook 2013 Using Outlook 3
M Predefined Outlook Fields not available to add into a BCM record BCM (Business Contact Manager) 0
B Add-in "always enabled" but Outlook 13 won't open Using Outlook 7
R Outlook 2013 People Pane - Where is the "Add" button for social networks? Using Outlook 4
V Outlook 2013 - iCloud add-in creates issues Using Outlook 4
Wotme code to run outlook add-in Using Outlook 1
L Outlook 2007 does not start with Apple iCloud-Add-In activated Using Outlook 2
O Add please, Outlook Autocomplete working per account in multi profile ! Outlook Wishlist 5
L Outlook 2007 Macro to Add Text to a Contact Field Using Outlook 10
M Add custom locations to Outlook Forms "Look In:" drop-down list Using Outlook 5
D Outlook Add-In That Calculates Time Based on Area Code Using Outlook 8
G Microsoft Outlook 2010 Add-On Using Outlook 2

Similar threads

Top