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..
 
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
G Add Map It button to Custom Contacts Form in Outlook Outlook VBA and Custom Forms 1
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
P VBA to add email address to Outlook 365 rule Outlook VBA and Custom Forms 0
S Outlook 2019 Custom outlook Add-in using Visual Studio Outlook VBA and Custom Forms 0
F Want to add second email to Outlook for business use Using Outlook 4
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
J GoDaddy migrated to Office365 - Outlook Wont Add Account Exchange Server Administration 21
F Outlook 2019 Outlook 2019 Add and Sync to New computer Comcast server Using Outlook 2
A iCloud Outlook Add In is causing Outlook 2021 to crash and got disabled Using Outlook 10
L did MS ever add way to text via Outlook Using Outlook 5
P How to add a column named categories when searching in Outlook Using Outlook 0
N Can't create NEW GROUP and add/remove a member from existing Group in Outlook Using Outlook 1
Witzker Outlook 2019 Pls. add a Prefix for OUTLOOK 2019 here Using Outlook 1
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) Using Outlook 0
Diane Poremsky The Best Outlook Store Add-ins Contest Using Outlook 0
Diane Poremsky Add to Outlook Contacts Bug (Fixed) Using Outlook 1
Diane Poremsky Add a Charm to Outlook Meetings Using Outlook 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

Similar threads

Back
Top