Examples: FindNextMatch method

1. This code looks up all entries containing "Smith" in the $Users view, and creates a directory navigator of the person's short name and internet address.

  Dim s As New notessession
  Dim myname As String
  myname = "Smith"  
  Dim myitems() As String
  Redim myitems(1 To 2)  
  myitems(1) =  "ShortName"
  myitems(2) =  "InternetAddress"
  Set mydir = s.GetDirectory("myserver")
  Set mynav = mydir.LookupNames("$Users", myname, myitems, True)
  While mynav.NameLocated  
    While mynav.MatchLocated    
      v = mynav.getFirstItemValue
      mynav.FindNextMatch  ' sets MatchLocated T/F
'    resume name loop
    mynav.FindNextName  ' sets NameLocated T/F
  Msgbox "complete"  

2. This button accesses the "My Contacts" view of the personal address book in the local directory and returns the values of the "FullName" and "InternetAddress" items for each document.

Dim session As NotesSession
Dim directory As NotesDirectory
Sub Initialize
	Set session = New NotesSession
	Set directory = session.GetDirectory("")
End Sub

Sub Click(Source As Button)
	Dim nav As NotesDirectoryNavigator
	Dim msg As String
	Dim value As Variant
	Dim items( 1 To 2) As String
	items(1) = "FullName"
	items(2) = "InternetAddress"
	Set nav = directory.LookupAllNames("My Contacts", items)
	If nav.CurrentMatches > 0 Then
		nav.FindFirstMatch 'not really needed
			value = nav.GetFirstItemValue
			msg = msg & Cstr(value(0)) & | |
			value = nav.GetNextItemValue
			msg = msg & Cstr(value(0)) & |
		Loop While nav.FindNextMatch
	End If
	Msgbox msg,, "My Contacts"
End Sub