August 29, 2004

How to get COM+ Activation String?

Make sure to include refrence for "COM+ 1.0 Admin Type Library"

Public Function getDBHelperActivationString() As String
Dim catalog As COMAdmin.COMAdminCatalog
Dim applications As COMAdmin.COMAdminCatalogCollection
Dim application As COMAdmin.COMAdminCatalogObject

Set catalog = New COMAdmin.COMAdminCatalog
Set COMAdminCatalogCollection = catalog.GetCollection("Applications")
Call COMAdminCatalogCollection.Populate

Dim comApplication As COMAdmin.COMAdminCatalogObject

For Each comApplication In COMAdminCatalogCollection
If (strConstructorString <> "") Then
Exit For
End If

Dim applicationComponents As COMAdmin.ICatalogCollection
Set applicationComponents = COMAdminCatalogCollection.GetCollection("Components", comApplication.Key)

Dim comComponent As COMAdmin.COMAdminCatalogObject
For Each comComponent In applicationComponents
If (comComponent.Name = "MRI_Svr_Db.DBHelper") Then
strConstructorString = comComponent.Value("ConstructorString")
Exit For
End If

getDBHelperActivationString = strConstructorString
End Function