我正在寻找以编程方式登录的当前Notes客户端用户的电子邮件地址。有办法吗?我正在通过会话访问用户名,但我需要电子邮件地址预先感谢。
您将需要在组织的通讯录(names.nsf)中查找电子邮件地址。
这里是Designer帮助中经过稍微修改的代码,您可以在其中输入用户的姓氏,并使用它在通讯簿中搜索电子邮件地址。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim books As Variant
Dim view As NotesView
Dim doc As NotesDocument
Dim done As Variant
Dim person As String
books = session.AddressBooks
done = False
person = Inputbox$ _( "Enter the last name of the person: ", "Last name" )
Forall b In books
' check every Domino Directory,
' unless we're already done
If ( b.IsPublicAddressBook ) And ( Not done ) Then
Call b.Open( "", "" )
' look up person's last name
' in People view of address book
Set view = b.GetView( "People" )
Set doc = view.GetDocumentByKey( person )
' if person is found, display the email address
' from the Person document
If Not ( doc Is Nothing ) Then
Messagebox( "Email for " + person " is " + doc.InternetAddress( 0 ) )
done = True
End If
End If
End Forall
' if done is still False, the person wasn't found
If Not done Then
Messagebox( "Sorry, unable to locate person's name." )
End If
End Sub