Accessing the COMAddins Collection

I have had the question posed to me twice in the last week:

If I am automating Outlook from another application, how do I get a reference to an Outlook COM Add-in created with VSTO 2005?

I responded to a customer, and then I answered it in our forums this morning, here:

Call VSTO Addin Functions from external application?

Bottom line: To Outlook, an add-in created by VSTO looks like a COM add-in to Outlook. It doesn't care that there is a difference (vive la difference!). In the registry, instead of a two-part progID, there is only one, just the name of the assembly. So, for example, I have an add-in called, "OutlookAddin18" running in Outlook right now. I can access it like this:

Dim olapp As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.ApplicationClass()

Dim o As Microsoft.Office.Core.COMAddIn

Dim addins As Microsoft.Office.Core.COMAddIns

addins = olapp.COMAddIns

o = addins.Item("OutlookAddin18")

Cool. So simple.

 Rock Thought for the Day: I am really wanting to get my hands on the Smashing Pumpkins "Mashed Potatoes" collection of songs. They are from a CD that the band made for close friends. I love rarities like this. I wish there were just a massive rarities mall so that you didn't have to search hither and yon to find what you want. If anyone knows of such a place (forget Ebay, folks; it ain't happenin' there), let me know.

What's the best rarity or bootleg you have ever found?

Rock On

Comments (7)

  1. tomra says:

    I’m saving all these morsels for a time when I can convince my management that Access 97 VBA isn’t the way any more. Good stuff.

    I had a Pearl Jam gig taped from Radio 1 (UK national ‘pop’ station), around the time ‘Ten’ was released. The same gig later appeared as a bootleg CD ‘Live in Finland’ or some such; it had big gaps where the DJ announced that this was Pearl Jam live at the Riverside – a club in Newcastle-upon-Tyne, U.K. It had the best version of ‘Even Flow’ ever: slow and heavy. Long since lost, of course.

  2. Tom,

    Thanks for the comment. Your Access 97 story is one I empathize with greatly. It’s also common. I can understand why companies resist upgrading: it’s always complicated, and it’s costly. But, eventually, they realize that not upgrading has its own costs. usually, they do not think of these costs until they are so obvious they cannot be ignored.

    I loved your Pearl Jam story. Too bad you lost it. I am so glad that PJ went ahead and started releasing all of their live shows on CD. Why other bands neglect to do this is a mystery to me. When you have a mega band, anything will sell at least 100,000 units. They could put Eddie belching on 12 tracks, and the true collector will still buy it.

    Take care!


  3. christian says:

    I have all of the bootlegs from CUD, a band that nobody else seems to know but me. In addition to the bootlegs, I also have CD copies of their rare albums, such as ‘Elvis Belt’ and ‘Donkey with a Fez On’

  4. David says:

    In C# how do I do this line:

    o = addins.Item("OutlookAddin18")

    I get a compilation error:

    ‘Argument had no modifier while parameter has modifier ‘ref”

    Thanks for any help!

  5. Sue Mosher says:

    John, Jay Harlow’s sample at has the piece that you didn’t cover — how to specify what class the COMAddin.Object property exposes. The sample includes an AutomationObject type (AutomationObject.vb) with two public properties and a public method. This is the key statement in ThisApplication_Startup that makes that class the one that the addin exposes:

        Me.COMAddIns.Item(ThisApplication.ProgId).Object = New AutomationObject(Me)

  6. hoi polloi says:

    " I wish there were just a massive rarities mall so that you didn’t have to search hither and yon to find what you want."

    And your definition of rarities would be…?

  7. In this episode: a tip about how to save a new copy of a Word document instead of saving over the original,

Skip to main content