Richtextitem properties inherited from notesitem

Notes help states: Because NotesRichTextItem inherits from NotesItem, all of the NotesItem properties and methods can be used on a NotesRichTextItem, too.

Here is my code:

Set rtitem=doc.GetFirstItem(“body”)

	If rtitem Is Nothing Then 

		Set rtitem=New NotesRichTextItem(doc,"body")

		Goto newone

	End If

	If rtitem.contains("An Interests form has been sent to") Then Goto skip

The value of rtitem is “An Interests form has been sent to Wade H HinesIBM XXXXXOperations Subteam”

The code doesn’t error out, but it doesn’t catch the match either…

I have also tried to use:

forall v in rtitem.values

if instr(v,“An interests…”) then goto skip

end forall

this errors out in runtime with type mismatch, although the Notes Help specifically lists this as a property for richtextitem inherited from notes item

any suggestions?

Subject: richtextitem properties inherited from notesitem

The contains method of the NotesItem class only searches for full exact matches, so that is why the contains call is not finding a match.

Use the text method of your rich text item to get the contents of your rich text field rather than the values property. That should clear up the type mismatch.

Subject: richtextitem properties inherited from notesitem

Thnx for the responses, all. Using instr(rtitem.values,“An interes…” did the trick as suggested.

Subject: richtextitem properties inherited from notesitem

The help states that rtitem.values will just return text, not an array, so your second example should work with just check instr(rtitem.values, “An interests…”)

Subject: richtextitem properties inherited from notesitem

NoteItem.Contains is used to check if any of the values in a multi-value field matches a specific value. It’s not a sub-string test.