I have a bunch of users I am adding to conference. They are contained both in a user's address book and on the Notes server/main company address book. Once I have the e-mail address of a user, is there a way to look up their user name?
+1
A:
You can lookup the internet email address in the company Name and Addresss Book (NAB) database. I believe out-of-the-box, there is a view in the NAB named "Person / By Internet Email". From within a Notes agent, you can use formula language (use @DBLookup) or script (using notesView.getDocumentByKey). Or you can use COM to do the lookup.
In script, this would look something like:
...
dim s as new notesSession, db as notesDatabase, vw as notesView, doc as notesDocument
set db = s.getDatabase (YOUR_SERVER, "names.nsf")
set vw = db.getView ("People\By Internet Mail")
set doc = vw.getDocumentByKey (EMAIL_ADDRESS_VALUE, true)
if not (doc is nothing) then
sName = doc.FullName(0)
end if
....
Ed Schembor
2010-08-10 18:42:13
People\By InternetMail is not a view that I can find. I'm doing this: Dim db As NotesDatabase Dim currentServer As New NotesName(s.CurrentDatabase.Server) Dim serverName As String serverName = currentServer.Common Set db = s.GetDatabase(serverName, "names.nsf")But that view doesn't return anything.
Corv1nus
2010-08-10 21:37:10
$Users also has the internet email adress as a key, so you can use that. Since you're using ND8 you should also use the NotesDirectory class to perform name lookups. Get this via the NotesSession.GetDirectory method.
kerrr
2010-08-11 10:50:48
When I do a getDocumentByKey with a valid address, like user @gmail.com, the $Users cannot find it. Additionally it returns empty on an FTSearch of an InternetAddress using the $Users view. I did the same with NotesDirectory, using the notesDir.LookupNames("$Users",EMAIL_ADDRESS, item, True) and got the same - empty. Is there another methond in NotesDirectory I should be using.
Corv1nus
2010-08-11 19:08:50
Actually, I've gotten something working. Now the issue is that if you have a duplicate user name in the local address book and on the notes server, it always uses the local one. Accepting this because it got me going in the right direction.
Corv1nus
2010-08-11 20:42:38
And finally, using the canonical name fixed it for me (instead of the common). Thanks for your help. :)
Corv1nus
2010-08-11 21:20:46