Tuesday, December 1, 1998

The new NotesOutline class in Notes 5.0

PROGRAMMING POWER

By Tony Patton

Last month, we discussed the many enhancements to LotusScript that are part of Notes and Domino Release 5.0. One of the items mentioned was the new outline feature and its corresponding NotesOutline class. This month we'll get much more in-depth, and you'll learn how to script with outlines.

Notes Release 5.0 has a distinctive Internet flavor to it. Developing applications for both WebWeb browsers and Notes clients was a nightmare with previous versions of Notes, but Release 5.0 has made the process much simpler by eliminating the need to develop for both. The Notes client now supports all elements supported by a typical Web browser. These elements include frames, HTML, Java applets, and more.

In addition, the new outline feature in Notes 5.0 adds the ability to assemble a site map. The site map gives you an overview of what is in an application -- and that application can include more than one database. The outline can also include links to Domino databases, views, documents, and Web sitesWeb sites (i.e., URLs). The Notes Release 5.0 development environment makes it easy to create and set up an outline, as shown in Figure A, and the NotesOutline and NotesOutlineEntry LotusScript classes are provided to work with an outline in script.

FIGURE A

You can easily create a Notes outline. (click for larger image)

Note: The first beta copy of Notes 5.0 was used in this article. Future updates to the 5.0 code may change aspects of the NotesOutline and NotesOutlineEntry classes.

A simple scripting example

Let's take a look at a short routine that makes use of the new outline features.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim outline As New NotesOutline(db)
Dim entry As NotesOutlineEntry
Set entry = outline.GetFirst
While Not (entry Is Nothing)
Print entry.TitleText
    Set entry = outline.GetNext(entry)
Wend
End Sub

Here's an explanation of what that all means:

  • First, we declare a new NotesOutline object. The parameter is the name of the database for the outline.
  • Next, declare a new NotesOutlineEntry object. This will be used to access individual elements in the outline.
  • The GetFirst method of the NotesOutline class is used to get a handle on the first element in the outline.
  • A while loop is used to scroll through all elements in an outline.
  • The TitleText property of the NotesEntry class returns the title text assigned to an entry.
  • The GetNext method is used to retrieve the next element from the outline, the current entry is passed as a reference point.