Convert VBA COM to C# COM interop (Outllook 2k)

  • Thread starter Thread starter Eric Chinn
  • Start date Start date
E

Eric Chinn

I am converting an Access 2k SQL Project to a WinForms
C# .Net solution. The last technical hurdle in this
exercise is to replace the integration with Outlook 2000.
(Upgrading Outlook is not a solution!)

In the VBA system, a note facility exists which allows the
user to associate a note with (almost)any business entity
in the database. The note can be just text or it can be a
replication of an email generated in Outlook! In the case
of the later, the user selects an email address and an
entity descriptor subject from respective comboboxes and
clicks a button. The button click event instantiates
Outlook and displays a New Mail document with the selected
email address and entity descriptor Subject pre-set. (The
Subject has a prefix which is used to identify and
associate subsequent replies, as described below!) When
the user completes and sends the email, the body text is
captured via the "WithEvents" linkage and is added to the
database.

Additionally, whenever new mail is received by Outlook,
the WithEvents linkage intercepts the item and examines
the Subject looking for a note identifier(mentioned
above). If found, the essence of the email (sender, body,
date received) is saved and associated with the
originating note in the form of a conversation thread.
(This thread can be extended ad infinitum.)

Also, on Startup, the VBA system examines the user's
Outlook Inbox looking for any unprocessed reply messages
and integrates them into the database as above.

My challenge is to replicate this process in the C# .Net
solution!
 
Eric,

This should be rather easy. You can create COM Add-Ins for Outlook (or
any Office app really), and then distribute that to every machine. I
believe there is a project template in the Enterprise Edition of VS.NET for
an Office Add-In which you can use which will set up all of the plumbing.

Hope this helps.
 
Nicholas:

Is the Office Add-in template available in VS Professional
2002!

Also, I'm having difficulty finding a C# counterpart to
the VBA "WithEvents" linkage!

Thanks for the speedy response!
 
Eric,

C# doesn't support WithEvents. Rather, you will have to connect to
events on a class on your own using delegates. Check out the section of the
..NET framework titled "Consuming Events". It will detail how you can hook
up delegates to events in C# (as well as VB).

Hopet his helps.
 
Back
Top