例: LotusScript® のクラスで文書リンクを処理する

次のエージェントは、現在の文書の Body アイテム内にある、すべての文書リンクで使用できるプロパティを表示します。

Dim session As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim rti As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtlink As NotesRichTextDocLink
Sub Initialize
  Set session = New NotesSession
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  Set rti = doc.GetFirstItem("Body")
  Set rtnav = rti.CreateNavigator
  If Not rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
    Messagebox "No doclinks in Body item",, "No doclinks"
    Exit Sub
  End If
  Do
    Set rtlink = rtnav.GetElement
    msg$ = "Replica ID = " & rtlink.DbReplicaID
    If  rtlink.ViewUNID <> String$(32, "0") Then
      msg$ = msg$ & Chr(13) & "View UNID = " & rtlink.ViewUNID
    End If
    If  rtlink.DocUNID <> String$(32, "0") Then
      msg$ = msg$ & Chr(13) & "Doc UNID = " & rtlink.DocUNID
    End If
    Messagebox msg$,, rtlink.DisplayComment
  Loop While rtnav.FindNextElement
End Sub