次のエージェントは、現在の文書の 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
msg$ = Chr(13)
Do
Set rtlink = rtnav.GetElement
msg$ =msg$ & rtlink.DisplayComment & Chr(13)
Loop While rtnav.FindNextElement
Messagebox msg$,, "List of links in Body item"
End Sub