Using OLE

The Notes® client is an OLE automation controller and server.

Note: This feature is not supported on UNIX, Mac, or HCL Nomad.

OLE automation controller

Notes® is an OLE automation controller. You can use the LotusScript® GetObject function to open an OLE automation object, and the CreateObject function to create an OLE automation object. You can also use the CreateObject and GetObject methods of the NotesUIDocument class.

OLE automation server

Notes® registers itself as an OLE automation server and provides the following OLE automation objects:

  • Notes®.NotesUIWorkspace provides access to the Domino® UI objects.
  • Notes®.NotesSession provides access to the Domino® Objects (that is, the back-end objects).

External applications can create and reference the automation objects, then work down through the object hierarchies. For example, a Visual Basic application might contain the following code:

Set workspace = CreateObject("Notes.NotesUIWorkspace")
Set doc = workspace.CurrentDocument


Set session = CreateObject("Notes.NotesSession")
Messagebox session.UserName

A Notes® client must be installed on the same machine as the Visual Basic program. Notes® runs as a separate process when acting as an OLE automation server.

OLE automation uses late binding. You cannot create new Domino® objects as you would in LotusScript®. You must create (for example, with CreateObject) a Notes®.NotesUIWorkspace or Notes®.NotesSession object and work down through the hierarchies using the available methods. For example, if you want to open a Domino® back-end database, create a Notes®.NotesSession OLE automation object, and then use the GetDatabase method of NotesSession to set a reference variable.

In Visual Basic, declare the reference variables for all Domino® objects as type Object. When you finish using a Domino® object, set the reference variable to Nothing to free the memory it uses.

Use dot notation, just as in LotusScript®, to access the properties and methods of an object.

Constants must be specified by actual numeric value rather than name. In LotusScript®, you can get the value by displaying it. For example: