Programmatically resolving names into addresses

Hi all

Sorry if this thread has come up, but I was not able to find info on it.

I am writing a Delphi application which integrates with the messaging and calendary features of Notes. Before I send a message I would like to be able to resolve the recipient names into actual notes addresses.

For example, John Smith would resolve into CN=John Smith/O=DOMAIN if it exists, and would not resolve if it does not exist.

Here is the pseudo code of what I have been trying to do so far.

for all addressbooks in NotesSession

–method 1

view = get people view

doc = view.GetDocumentByKey(name, false)

–method2

for each document in docs in addressbook

nameVal = doc.fullname(1) //full name not in notes format

if name = nameVal then doc = document 

–method 3

similar to method 2 in terms of looping through every document but I create NotesName object for both recipient name and for the e-mail address of the document and compare the common name properties on those.

end //for all addressbooks

return doc

All of these methods have a flaw. They will resolve Recipient name = John Smith just fine, but they will not resolve Recipient name = Smith John and perhaps some others normally accepted by Notes.

Is there an accepted way of resolving recipient names into addresses in Notes or am I stuck with one of my methods. Has this already been discussed. If so could someone please point me to that thread. Any help is welcome.

–eugene

Subject: Programmatically resolving names into addresses

Try something like this, if the “name” variable is what you are looking for. “name” is in the Common Name format - “John Smith”

Call db.Open((Server Name), “names.nsf”)

Set view = db.GetView(“($Users)”) 'not the best view to use…

Set doc = view.GetDocumentByKey(name, True)

If doc is nothing then

'No person document…

Else

set newName = New NotesName(doc.FullName(0))

canonName$ = newName.Canonical

End If

Might get you off and running…

HTH