I am trying to search for and remove Recent Contacts that contain certain text in the MailAddress field.
I am using the below code which returns a collection count of 0 even though using the same searchFormula$ in a view selection returns the correct documents.
Sub Initialize
On Error Goto ErrHndlr
Dim session As New NotesSession
Dim db As New NotesDatabase(“”, “names.nsf”)
Dim view As NotesView
Set view=db.GetView(“Recent Contacts”)
searchFormula$={@Contains(MailAddress; “@domain.com”) | @Contains(MailAddress; “@domain2.com”)
Dim collection As NotesDocumentCollection
Set collection=db.Search(searchFormula$, Nothing, 0)
Call collection.RemoveAll(True)
ErrHndlr:
Print Error$
End Sub
Any help?