- This LotusScript® agent
gets the value in the item "email" of the first instance of the name
"John" in the view "Contacts" in the directory on the default server.
Sub Initialize
Dim s As New NotesSession
Dim direct As NotesDirectory
Dim nav As NotesDirectoryNavigator
Dim value As Variant
Set direct = s.getDirectory
Set nav = direct.LookupNames("Contacts","John","email")
value = nav.GetFirstItemValue
Msgbox "Value: " + Cstr(value(0))
End Sub
- This LotusScript® agent
gets the values in the items "email" and "ShortName" of the first
instances of the names "Anne", "Bob", and "Carlos" in the view "Contacts"
in the directory on the default server.
Sub Initialize
Dim s As New NotesSession
Dim direct As NotesDirectory
Dim nav As NotesDirectoryNavigator
Dim value As Variant
Dim searchArray (1 To 3) As String
Dim itemArray (1 To 2) As String
Set direct = s.getDirectory
searchArray(1) = "Anne"
searchArray(2) = "Bob"
searchArray(3) = "Carlos"
itemArray(1) = "email"
itemArray(2) = "ShortName"
Set nav = direct.LookupNames("Contacts", searchArray, itemArray)
End Sub
- 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 that matches a name.
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 names As String
Dim items( 1 To 2) As String
items(1) = "FullName"
items(2) = "InternetAddress"
names = Inputbox$("Enter last name")
If names = "" Then Exit Sub
Set nav = directory.LookupNames("My Contacts", names, items, True)
If nav.CurrentMatches > 0 Then
Do
msg = msg & Cstr(nav.CurrentMatch) & | |
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
- This button accesses the "People" view of the Domino® directory on a server and returns the
values of the "FullName" and "InternetAddress" items for each document
that matches a name.
Dim session As NotesSession
Dim directory As NotesDirectory
Sub Initialize
Set session = New NotesSession
Set directory = session.GetDirectory("myserver/Acme")
End Sub
Sub Click(Source As Button)
Dim nav As NotesDirectoryNavigator
Dim msg As String
Dim value As Variant
Dim names As String
Dim items( 1 To 2) As String
items(1) = "FullName"
items(2) = "InternetAddress"
names = Inputbox$("Enter last name")
If names = "" Then Exit Sub
On Error Goto errh ' Bad server name causes exception
Set nav = directory.LookupNames("People", names, items, True)
On Error Goto 0
If nav.CurrentMatches > 0 Then
Do
msg = msg & Cstr(nav.CurrentMatch) & | |
value = nav.GetFirstItemValue
msg = msg & Cstr(value(0)) & | |
value = nav.GetNextItemValue
msg = msg & Cstr(value(0)) & |
|
Loop While nav.FindNextMatch
End If
Msgbox msg,, "People"
Exit Sub
errh:
Msgbox Error(),, Err()
Exit Sub
End Sub