RichTextNavigator Doesn't Work

I have the following code in an agent. Most of it I copied directly from the R-6 documentation.

While Not thisDoc Is Nothing

	If thisDoc.Form(0) = "note" Then

		Set rti = thisDoc.GetFirstItem("Attachments")

		If rti Is Nothing Then

			If Msgbox("Could not get item attachment",MB_YESNO,"Problem") = IDNO Then

				Exit Sub

			Else

				Goto goNext

			End If

		End If

		Set rtnav = rti.CreateNavigator

		If Not rtnav.GetFirstElement(RTELEM_TYPE_DOCLINK) Then

			Msgbox "No doclinks in attachment", , "No doclinks"

		End If

		Do

			Set rtlink = rtnav.GetElement

			If rtlink.ServerHint = "" Then

				server = "Local"

			Else

				server = rtlink.ServerHint

			End If

			msg = "Server = " & server

			msg = msg & Chr(13) & "Replica ID = " & rtlink.DBReplicaID

			If rtlink.ViewUNID <> String$(32,"0") Then	'If the ViewUNID is 32 zeros, there is no view

				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

			Msgbox msg,, rtlink.DisplayComment

			If Msgbox ("Continue?", MB_YESNO,"Question") = IDNO Then Exit Sub

		Loop While rtnav.FindNextElement

	End If

goNext:

	Set thisDoc = thisView.GetNextDocument(thisDoc)

Wend

The agent fails every time with a type mismatch with the debug pointer located at the “If Not rtnav…” line. When I look at the variables in the debug window, rtnav is nothing. This is an R-5 database but I’m running the agent on an R-6 client (hence posting here). I recognize that the NotesRichTextNavigator class is new with R-6 but since it’s not an NSF element, this code should still work… right? P.S. I have %included lssconst.

Can anyone help?

Thanks.

Randy

Subject: RichTextNavigator Doesn’t Work

Don’t have the documentation available to check, but it looks like you meant to use FindFirstElement, which returns a Boolean value, instead of GetFirstElement, which returns the actual element.

Subject: RE: RichTextNavigator Doesn’t Work

You are right. That’s what I get for blindly following the documentation. The example for for NotesRichTextDocLink clearly uses GetFirstElement. When I changed the code as you suggested, it worked fine.

Thanks.

Randy

Subject: RE: RichTextNavigator Doesn’t Work

Please use the Feedback link on the help document to suggest the correction to the documentation group.