2.1 Visual Basic

This section describes how to accomplish the following:

2.1.1 Retrieving Application Objects

In Visual Basic, to get a GroupWise Application object, you can choose between:

Early Binding

Early Binding is recommended for most uses. It provides advantages in development, debugging, and run-time. The greatest advantage is that it gives your executable faster performance since it doesn't have to look up the CLSIDs (class identifiers) from the Windows registry at run-time. You can declare objects as an application, message, or appointment object, rather than just declaring it as a generic object. After you have declared the objects, the name completion function (shown below) works to complete object, parameter, and method types. It will also provide you the information you need about objects, methods, or parameters.

Figure 2-1 Name Completion Function

For example, as you start typing a method, it shows you the parameters you can utilize, as shown below.

Figure 2-2 Method Popup That Shows Parameters

To use early binding, follow these steps:

  1. From the Project menu, select References.

  2. A dialog appears that lists a group of available references (or libraries). Check the GroupWare type library box and click OK.

  3. If you want to view the objects, properties, and methods from the View menu, select Object Browser.

NOTE:Always use the latest version of the objects. For example, if the object has a number next to it, use the last one, such as Application2 or Appointment3 (as shown below).

Figure 2-3 Choosing Object Versions

The following illustrates the creation of an instance of the GroupWise Application object with early binding:

Set objGroupWise = New Application2

Late Binding

Late binding is not recommended for most cases. It provides advantages when you want to get back multiple objects. The disadvantage is that it requires the executable to look up the CLSID from the Windows registry at run-time, making it slower. Late binding uses only the types given by Visual Basic. Thus, you have to declare all objects to be of the generic "Object" or Variant type.

To use late binding, you need to use the CreateObject call to create an generic object.

The following illustrates the creation of an instance of the GroupWise Application object with late binding:

Dim objGroupWise as object

Set objGroupWise = CreateObject("NovellGroupWareSession")

2.1.2 Log In

Next, log in to GroupWise by following the steps for

Logging In With Early Binding

For early binding, log in by invoking the Application object's (objGroupWise) Login method. From Visual Basic, use:

Dim objAccount as Account2

Set objAccount = objGroupWise.Login(txtUserID, txtCommandLine) 

Your application is now logged in to GroupWise and the Application object (objGroupWise) properties are valid. Information store contents are accessible through the Application object.

Logging In With Late Binding

In late binding, you are able to use the same login method as above. However, you just need to declare objAccount as an "Object" (the type given in Visual Basic) instead of Account2. TxtUserID and txtCommandLine are optional parameters. If they are left out, GroupWise attempts to log you in by first trying your NDS login ID, then your Windows login ID, and finally by trying the information stored in the registry from your last successful login.

If you don’t need to use the GroupWise account later, you can replace the Set objGWAccount = with Call. The string txtUserID is the user ID name. The string txtCommandLine contains any valid command line parameters. You can also pass optional third and fourth parameters for the GroupWise Password and When to Prompt respectively.

Your application is now logged in to GroupWise.