LOTUSSCRIPT/COM/OLE CLASSES


Examples: Accessing item properties
This example displays properties for a NotesItem object.

Sub Click(Source As Button)
 Dim workspace As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Dim doc As NotesDocument
 Dim item As NotesItem
 itemName = Inputbox("Which item?")
 Set uidoc = workspace.CurrentDocument
 Set doc = uidoc.Document
 Set item = doc.GetFirstItem(itemName)
 Select Case Item.Type
 Case ATTACHMENT : itemType = "File attachment"
 Case EMBEDDEDOBJECT : itemType = "Embedded object"
 Case ERRORITEM : itemType = _
 "Error occurred while accessing type"
 Case NAMES : itemType = "Names field"
 Case AUTHORS : itemType = "Authors field"
 Case READERS : itemType = "Readers field"
 Case NOTELINKS : itemType = _
 "Reference to the parent document"
 Case NOTEREFS : itemType = "DocLink"
 Case NUMBERS : itemType = "Number or range of numbers"
 Case RICHTEXT : itemType = "Rich text"
 Case SIGNATURE : itemType = "Signature"
 Case DATETIMES: itemType = _
 "Time-date value or range of values"
 Case TEXT : itemType = "Text or text list"
 Case UNAVAILABLE : itemType = "Not available"
 Case UNKNOWN : itemType = "Unknown"
 Case USERDATA : itemType = "User data"
 Case USERID : itemType = "User ID file"
 Case Else : itemType = Item.Type
 End Select
 Messagebox "Name: " & item.Name
 Messagebox "Type: " & itemType
 Messagebox "Text:" & Chr(10) & item.Text
 Messagebox "ValueLength: " & item.ValueLength
 If item.Type = RICHTEXT Then
   Messagebox "Values:" & Chr(10) & item.Values
 Elseif item.Type = DATETIMES Then
   Messagebox "Date: " & _
   item.DateTimeValue.LSLocalTime
   Elseif item.Type <> NOTELINKS _
 And item.Type <> NOTEREFS _
 And item.Type <> UNKNOWN _
 And item.Type <> UNAVAILABLE Then
   Forall itemValue In item.Values
     Messagebox "Values:" & Chr(10) & itemValue
   End Forall
 End If
 If item.IsEncrypted Then Messagebox "Is encrypted"
 If item.IsSigned Then Messagebox "Is signed"
 If item.IsSummary Then Messagebox "Is summary"
 If item.IsProtected Then Messagebox "Is protected"
 If item.IsNames Then Messagebox "Is names"
 If item.IsReaders Then Messagebox "Is readers"
 If item.IsAuthors Then Messagebox "Is authors"
End Sub

See Also