Example: Working with doclinks in LotusScript® classes

This agent displays the applicable properties for all the doclinks in the Body item of the current document.

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
    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