Link to home
Start Free TrialLog in
Avatar of glenn_r
glenn_r

asked on

Get lotus notes email address list

I have a project where i need to get a list of email addresses from Lotus Notes. I downloaded the MS VB.NET sample code application from IBM's website (http://www.ibm.com/developerworks/lotus/library/domino-msnet/) . Everything works but I'm getting back all the email addresses from names.nsf. The customer says they store addresses from many companies in names.nsf and that the address list I'm looking for is in a Directory. Not sure if Directory is the correct terminology but from what I understand they store each companies addresses in a separate directory.

With the vb.net code below how can I
A) limit the address list to a specifed directory or
B) cycle through the addresses to produce the desired result set.

Any advice would be greatly appriciated.

Thanks,
Glenn

'--------------------------------------------------------------------------------------------

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs)Handles MyBase.Load
  Dim s As New NotesSession
    s.Initialize()
  Dim db As NotesDatabase
  Dim vw As NotesView
  Dim doc As NotesDocument
    db = s.GetDatabase("ServerName//Domain", "names.nsf", False)
  If Not (db Is Nothing) Then
    vw = db.GetView("_People")
    doc = vw.GetFirstDocument()
    While Not (doc Is Nothing)
      cboNames.Items.Add(doc.GetFirstItem("FirstName").Text + " " +
        doc.GetFirstItem("LastName").Text)
        doc = vw.GetNextDocument(doc)
    End While
  End If
End Sub
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

names.nsf is the name of the server's master directory. Next to the system's users, it contains the whole configuration for all servers in the same Domino domain. Actually, names.nsf is not the proper place to store client information.

You could open other directories, either by name when you know the names, or by using different objects first:
- NotesDirectory and NotesDirectoryNavigator
- NotesDbDirectory and find the directories first

There are some examples in the Help database and in other fora on the net.
Avatar of glenn_r
glenn_r

ASKER

sjef,

When you say open other directories do you mean open other .nsf files or directories within the names.nsf file?

Can you give me an example of how to cycle thru the directories in the names.nsf file. Using this I could determine the names of its directories.

Thanks,
Glenn
A Domino directory used to be called the Domino Name & Address Book (or NAB). The Domain NAB is a database with contacts and a lot of other things, it contains the configuration per server (mail, web, etc.). Next to the public address book type of database, there are private address books (that may be shared by other people) that take less load with them (less config).

So, names.nsf the the most important Directory of a server. There may be additional directory databases, from other Domino Domains (e.g. clients or test domains), or internal shared directories.

If you don't know these directories by name, you can retrieve the list of databases from the server, scan through them and pick the databases that are marked as Directory (or Address Book).

Oh, and there's another way to get the directories: use the AddressBooks property in NotesSession.
Read this and the example in it:
http://bumble.co.genesee.ny.us/help/help7_designer.nsf/2e73cbb2141acefa85256b8700688cea/02a707852bd9b6f58525704a00410212?OpenDocument
Avatar of glenn_r

ASKER

sjef I'll grant you the original 125 points.

I've tired to enumerate the collection of addressbooks and directories. The same code in my clients environment throws an error that is not descriptive. I'm OK with all the addresses. I know how to get people and their internetemailaddresses. How do I get groups? I need some instruction on how get the groups and return back the email addresses of everyone in the group using a com component from vb.net.

Thanks,
Glenn
Well thanks! :-)

People you'll find in the $People view, groups in $Groups... But we careful: a group can contain both names of users and names of other groups. If you want to find ALL users in a group, you'll have to descend the group-tree recursively.
Avatar of glenn_r

ASKER

sjef I would like to get a list of groups and then the names and email addresses of each member of the group. Can you give me some sample vb.net code on how to do this?

Thanks,
Glenn
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial