Examples: Remove method (NotesRichTextDocLink - LotusScript®)

This agent removes doclinks from the Body item of the current document at user discretion.

%INCLUDE "lsconst.lss"
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
    If Messagebox("Do you want to delete this doclink?", _
    MB_YESNO + MB_ICONQUESTION, _
    rtlink.DisplayComment) = IDYES Then
      rtlink.Remove
    End If
  Loop While rtnav.FindNextElement
  Call doc.Save(True, True)
End Sub