Using COM type libraries in C/AL
A COM type library is a binary file containing the definition of a COM component.
How to do it...
To illustrate the principles of working with OLE automation in NAV, we will create a simple codeunit that reads data from a NAV server configuration file that is stored in XML format.
Create a
codeunit
object in C/SIDE object designer.All code will be placed in the
OnRun
trigger of thecodeunit
. Open local variables of the trigger and create aXMLDoc
variable. In the DataType field, select the Automation option.Click the assist button in the Subtype field to open a list of automation objects registered in the system. At first, the list is blank. Click on the lookup button in the Automation Server field to see the list of available automation servers.
Select Microsoft XML, v6.0 in the Automation Server List form:
After you click OK and return to the previous form, the list of automation objects will show objects exported from the selected library. Select the DOMDocument60...