Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing Lotus Notes address book via script

Status
Not open for further replies.

skwareks

Programmer
Dec 1, 2004
2
US
Hi,

We are new to Lotus Notes and have a problem. We need to access LN address book via script to import the email address into XML based on the name.

Exmaple:
we have an XML coming from DB2 and one of the tags will hold a name "John Doe" based on that name we need to pull the email address from LN address book.


Does anyone know if this can be done. If yes, how could we do it?

Many Thanks!!
Sebastian
 
Accessing the address book itself is easy :
Code:
Dim session as new notessession
dim db as notesdatabase
dim nab as notesdatabase

set db = session.currentdatabase
set nab = session.getdatabase(db.server,"names.nsf")
Once there, you need to access the correct People view to search for your individual :
Code:
dim view as notesview
set view = nab.getview(peopleviewname)
Note that I leave the name of the view up to you. I would think your best choices are ($People), ($VIMPeople), or ($Users), but I'll leave it up to you to check that out.

You see, the issue is with the name format. A person named John Doe is not named like that in Notes. His name would look a lot more like

CN=John Doe/O=companyname

And that is where the trouble starts, because you are getting John Doe as entry string.
It will be up to you to find the best view and the way to reformat the string before using code like this :
Code:
Dim username as string
...'define username contents
Dim doc as notesdocument

set doc = view.getdocumentbykey(username)
When you have that, you have the document containing all the details of the user. Up to you then to extract the info and use it as required.

Good luck !

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top