LOTUSSCRIPT/COM/OLE CLASSES


GetFirstItem method
Example

Given a name, returns the first item of the specified name belonging to the document.

Defined in

NotesDocument

Syntax

Set notesItem = notesDocument.GetFirstItem( name$ )

Parameters

name$


Return value

notesItem


Usage

A document may contain more than one item of the same name. To access other than the first item, use the Items property of NotesDocument. This code gets all items named "Item33":


If the value of a field is computed for display, the value is not stored as an item. The value is inaccessible from a NotesDocument object, unless the object is accessed as the Document property of NotesUIDocument, and GetFirstItem returns Nothing. In some cases, you can use LotusScript to access the field value another way. For example, if a document has a DateComposed field that's computed for display with a formula @Created, use the Created property in NotesDocument.

Using this method to get rich text items

The compiler raises an error if you try to set the return value of GetFirstItem equal to a NotesRichTextItem object. This is because a NotesItem is not necessarily a NotesRichTextItem, and the compiler has no way of knowing whether the name$ you specify actually corresponds to a rich text item. For example:


The solution to this problem is to declare a variant, set it equal to the return value of GetFirstItem, and then treat the variant as a NotesRichTextItem. For example:
Language cross-reference

getFirstItem method in Java Document class

Example
See Also