Domino Code Fragment

Code Name*
Phone # Lookup
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.145.131.238
Description*
Users are prompted for a first and/or last name to lookup. The script searches local and public address books and returns each name found in it's own window displaying the full name, department, and office phone number.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
This script should be put into a button.

Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim books As Variant
Dim view As NotesView
Dim dcol As NotesDocumentCollection
Dim person(0) As Variant
Dim matchctr As Long
Dim msgbox1 As String
Dim msgbox2 As String
Dim msgbox3 As String
Dim msgboxd As String


Dim results As New NotesDocument(session.CurrentDatabase)

person(0) = Inputbox$("Enter the name, first and/or last, you wish to find.")
If person(0) = "" Then Exit Sub
books = session.AddressBooks


Forall b In books
Call b.Open( "", "" )
Set view = b.GetView( "($Users)" )
Set dcol = view.GetAllDocumentsByKey(person(0))
If dcol.Count > 0 Then
matchctr = matchctr + 1
Set doc = dcol.GetFirstDocument
While Not (doc Is Nothing)
If Len(doc.LastName(0)) > 0 Then
Msgbox1 = doc.FirstName(0) & " " & doc.LastName(0)
End If
If Len(doc.OfficePhoneNumber(0)) > 0 Then
msgbox2 = "(o) " & doc.OfficePhoneNumber(0)
End If
If Len(doc.Department(0)) > 0 Then
Msgbox3 = doc.Department(0)
End If
Msgbox msgbox1 & " - " & msgbox3 & " " & Chr$(10) & msgbox2, 0+64, "Phone Number Lookup Results"
Set doc = dcol.GetNextDocument(doc)
Wend
End If
End Forall


If matchctr = 0 Then
Msgbox "Sorry, unable to locate name. "
End If
End Sub