例: GetValueDateTimeArray method

次のエージェントは「Times」という日時アイテムの値を取得します。エージェントは値の各要素をチェックし、NotesDateTime と NotesDateRange のどちらのオブジェクトであるか確認します。

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim item As NotesItem
  Dim count As Integer
  Dim times As Variant
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  If dc.Count = 0 Then Exit Sub
  Set doc = dc.GetFirstDocument
  Set item = doc.GetFirstItem("Times")
  times = item.GetValueDateTimeArray()
  count = 0
  Forall t In times
    count = count + 1
    If Typename(t) = "NOTESDATETIME" Then
      Messagebox t.LocalTime,, "Date/time # " & count
    Elseif Typename(t) = "NOTESDATERANGE" Then
      Messagebox t.StartDateTime.LocalTime & " - " & _
      t.EndDateTime.LocalTime,, "Date/time # " & count
    End If
  End Forall
End Sub