次のエージェントは、現在の文書の 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
Set rtlink = rtnav.GetElement
If rtlink.ServerHint = "" Then
Messagebox "Doclink is on a local database",, "Doclink server"
Else
Messagebox "Doclink is on " & rtlink.ServerHint,, "Doclink server"
End If
End Sub