Remove Doclink

Hi,

I have one doc link in a richtext field. When I am exicuting the following code to remove that doc link, it is throwing an error,“Resrtcted operation cannot crossed logical boundries”.

Any idea how to overcome this.

codes written–>


%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


regards,

Saswat

Subject: Remove Doclink

Your code works fine for me.

I did find a couple of posts on the forum that mentioned receiving this problem when the link was within a section or table in a rich text field but I tested both and don’t get any problems.