COM Registration
This section discusses the registration of the .NET SDK library to be used by COM client applications running on Microsoft Windows such as Microsoft Excel, Access, Outlook, and other VB/VBA applications that can interact with the COM interface. If your application is not a COM client application, you can skip to the next section for Request Basics.
Assembly Registration Utility
To register the .NET SDK data types and methods for COM interop, the assembly registration
utility RegAsm
on Windows will be needed. Open a command prompt window as an
administrator and in the .NET Framework directory, navigate to the CLR version for
the messaging SDK. For example, the Framework directory can be located on your Windows as
C:\Windows\Microsoft.NET\Framework
or C:\Windows\Microsoft.NET\Framework64
Choosing C:\Windows\Microsoft.NET\Framework
or C:\Windows\Microsoft.NET\Framework64
will
depend on whether Microsoft Office application is 32-bit
or 64-bit
.
If Office is 32-bit
, you will need to navigate to C:\Windows\Microsoft.NET\Framework\v2.0.50727
or
C:\Windows\Microsoft.NET\Framework\v4.0.30319
to enter the registration tool directory.
For 64-bit
Office, navigate to C:\Windows\Microsoft.NET\Framework64\v2.0.50727
or
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
directory.
It must be noted that running a 64-bit operating system does not necessariliy imply that Office application is also 64-bit. You will need to check whether your Office application is 32-bit or 64-bit in order to know which directory to navigate to.
Once in the directory, we can now begin to register the SDK assembly for COM interop in order to be able to integrate our messaging API in VB/VBA applications.
Registering Component
Before running the command to register for COM interop and export of the type library, ensure you have copied the SDK in the right and preferred directory. Suppose the SDK has been copied to the following directory:
C:\MyApps\Zenoph.Notify.dll
then we will run the following command:
regasm /codebase /tlb C:\MyApp\Zenoph.Notify.dll
This will register the SDK for COM interop and also create a type library that will be referenced in VB/VBA applications. We will now be able to select the messaging library and use the SDK in VB/VBA applications such as in Excel, Access, Outlook, etc.
Adding Library Reference
After registering the .NET SDK and creating type library file, you will be ready to create data types and call methods to send messages from VB/VBA applications. To be able to expose data types and methods in VB/VBA projects, a reference to exported type library from the .NET SDK can be referenced in the application.
For example, from the Tools menu in Excel VBA project, click on References menu item. This will display the References window. Scroll to select Notify Messaging Library and click OK in order to be able to reference data types and methods from NET SDK for messaging.
Unregistering Component
If there is the need to unregister the .NET SDK from COM interop, the RegAsm
utility
will again be needed. For example, this may be necessary when updating the SDK to a newer version.
In this case the /u
flag must be specified. The *.tlb
file as
well as the SDK library file must also be specified to be unregistered.
The following command will unregister the SDK from COM interop:
regasm /u /tlb:C:\MyApp\Zenoph.Notify.tlb C:\MyApp\Zenoph.Notify.dll
Notice that we have specified the type library file in order for the *.tlb
file to
be unregistered as well.