- The following example searches the directory on the server "server
name" for the home server information of "Joe Smith" then displays
that information.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mynotesdir As NotesDirectory
Set mynotesdir = session.getDirectory("server name")
Dim homeserver As Variant
homeserver = mynotesdir.GetMailInfo("Joe Smith", True)
Msgbox "Mail Server: " + Cstr(homeserver(0))
Msgbox "Build Number: " + Cstr(homeserver(1))
Msgbox "Domino Version: " + Cstr(homeserver(2))
Msgbox "Mailfile: " + Cstr(homeserver(3))
Msgbox "Short Name: " + Cstr(homeserver(4))
Msgbox "MailDomain: " + Cstr(homeserver(5))
Msgbox "Username: " + Cstr(homeserver(6))
Msgbox "internetMailAddress: " + Cstr(homeserver(7))
Msgbox "Out of Office: " + Cstr(homeserver(8))
End Sub
- The following example uses the getver flag to get partial
information about a user's mail file server if the first attempt to
get mail information fails.
Function RetrieveMailInfo() As Integer
On Error Goto ErrHandle
RetrieveMailInfo = False
Me.m_vOwnerMailInfo = Me.m_dirDirectory.GetMailInfo(Me.m_dbOwner, True)
If Isempty(Me.m_vOwnerMailInfo) Then
Me.m_vOwnerMailInfo = Me.m_dirDirectory.GetMailInfo(Me.m_dbOwner, False)
End If
End Function
- This button gets the mail information for a user.
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 mailinfo As Variant
Dim ooo As String
Dim mailmsg As String
Dim mailname As String
mailname = Inputbox$("Name of user")
On Error Goto mailerror
mailinfo = directory.GetMailInfo(mailname, True, False)
On Error Goto 0
If mailinfo(8) = "1" Then
ooo = "Agent"
Else
ooo = "Service"
End If
mailmsg = "Mail server:" & mailinfo(0) & |
Build number: | & mailinfo(1) & |
Domino version: | & mailinfo(2) & |
Mail file: | & mailinfo(3) & |
Short name: | & mailinfo(4) & |
Mail domain: | & mailinfo(5) & |
User name | & mailinfo(6) & |
Internet mail address: | & mailinfo(7) & |
Out of office service type: | & ooo
Messagebox mailmsg,, "Mail information for " & mailname
Exit Sub
mailerror:
Messagebox Error(),, "Error number " & Err()
Exit Sub
End Sub