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
- Anonymous
January 30, 2006
The comment has been removed - Anonymous
January 31, 2006
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!
John. - Anonymous
January 31, 2006
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' - Anonymous
March 01, 2006
The comment has been removed - Anonymous
March 01, 2006
John, Jay Harlow's sample at http://www.tsbradley.net/Samples/VSTO/Xml.Export.Sample.aspx 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) - Anonymous
March 01, 2006
" 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...? - Anonymous
May 28, 2008
In this episode: a tip about how to save a new copy of a Word document instead of saving over the original,