views:

1290

answers:

2

I am implementing COM Add-In for Outlook. I use IDTExtensibility2. I am not sure whether this is the best way of doing COM Add-Ins but I cannot change that.

This interface defines five methods: OnConnection, OnStartupComplete, OnAddInsUpdate, OnBeginShutdown, OnDisconnection.

I need to perform the following operations:

  1. Load configuration data from file
  2. Load registry data
  3. Start new session
  4. Create *.pst file
  5. Subscribe to Explorer events
  6. Connect to Internet Server to get some data
  7. Create menu items in the main menu
  8. Create a toolbar
  9. Add/Remove several things in Outllok (on *.pst files level)

Please advise, what I am supposed to do when?

  • What I need to perform in OnConnection method?
  • What is allowed only when OnStartupComplete invokes?
  • What resources I need to free dispose during OnBeginShutdown / OnDisconnection?
A: 

Hello Mike,

This is a good starting place:

http://msdn.microsoft.com/en-us/library/aa537182.aspx

HTH

Colby Africa

Colby Africa
+1  A: 

Note that 1,2 and 6 are not Outlook-addin-specific tasks.

3 is not needed: As an addin you don't create a session - you get connected with an existing one (by implementing the OnConnection method).

For 4 and 9 I recommend using RDO: http://dimastr.com/redemption/ (can also be used for 3 if you really need another session)

For 5,7 and 8 I recommend using ADX: http://www.add-in-express.com/add-in-net/
(you won't actually have to worry about IDTExtensibility2 at all anymore if you do this)

OnConnection is where you grab your reference to the Application interface from which you can derive everything else.

OnStartupComplete is where you can put all your initialization code.

OnDisconnection is where you should release all remaining OOM references you may have accumulated during the session, i.e everything that was derived from the initial Application reference that you received via OnConnection.

Oliver Giesen