Notes Databases on the Domino Server

The Notes COM Toolkit comes with a sample VB app called ReadMail.  In the app's initialization, the database "NAMES.NSF" is opened and the view "Locations" retrieved.  From this view, the call GetAllDocumentsByKey is made and a NotesDocumentCollection returned.

In this sample, only the first document is used.  Is there ever more than one document in this collection?

From this document, the item values for "MailServer", "MailFile", and "MailType" are retrieved.  Is there corresponding values for Contacts, ToDo items, Calendar items and Journal items?
jlalandeAsked:
Who is Participating?
 
marilyngCommented:
Ah, there can be more than one address book.  IN the notes classes there are public address books and private address books.  

So, the notesDatabaseArray = notesSession.AddressBooks

forall ndb in notesdatabasearray
  if ndb.isPublicAddressBook then
       'do something
  end if
  if ndb.isPrivateAddressBook then
     'do something
  end if
end forall

The public address book is the one that sits on the Notes Server and is usually: names.nsf  but the difference is the forms, and views that it contains.  It contains all active users, server information, connections, etc.  It is the heart of the Domino system.

The private address book is the user's local address book and contains location documents, connection documents, and private contact names, private groups.  

Both address books have a "person" form that contain similar information: firstname, lastname, fullname, middleinitial, phone numbers, address, home address, etc.  Usually the server version doesn't contain any personal contact information, like home address, home phone.

when you get addressbooks using the session class, it will collect all addressbooks on the server or local, depending on where you are calling it.  Then you have to cycle through the books to find the one that you need.   In some places, there are several "public address" books, and some private ones on the server as well.   I have three local, private address books.

The one that is being used  on a user's client is the first one named in the Notes.INI

In the INI are several environment values that can be collected by the session object:
Directory:  the users data directory location
MailFile: the filepath and filename of the user's mail file (or the last person who logged on to that machine)

Location: the name of the Location document that is being used, or was last used by the person who last logged into Notes.  This is a string of three values:  location doc name, some value, cn=john doe/ou=department/o=domain
         >>so you split the value and collect the first and third entry.

NAMES: the name of the primary local address book.  Again, this can be a string of many databases, i.e. names.nsf, myfriends.nsf, officefriends.nsf.
       >>you collect the string, if it has a comma, then split into an array and grab the first entry - that is the user's primary address book.
      >>if you want to collect ALL the contacts, then split, and loop through all the address books listed.

      >>caveat, the second address book MAY be a lite directory, or a condensed listing of all the NAB entries, so you can't cycle through that one.

---------
so, as long as you're collecting the same information, the only thing you're going to have to worry about is duplicates and outdated entries in the local address book.

Best approach is to collect from the server address books first.  Then as you collect from users, check for duplicate names (lowercase fullname).  Users copy entries from the server to their local, and usually don't remember to update them.  You can be overwriting good stuff with old outdated, or getting LOTS of duplicate entries.

That should be enough for this answer.. whew!  Let me know what else.

0
 
marilyngCommented:
to answer your questions: a collection returns one or more documents, or no documents.  In this example, they only need one document that contains the fields: "MailServer", "MailFile", and "MailType" - in order to open the mail file and access the mail.

 Contacts, ToDo items, Calendar items and Journal items << yes, Contacts can be stored in the mail file, or in the address book, but there are different forms and views/folders for each of these items.   But these are int he MAIL FILE and not the LOCATION DOCUMENT.  Once you have a handle on the MAIL FILE, then you can access the contents:  mail, calendar, todo.  Journal Items reside in a local database called: journal.nsf, and that database name is listed in the "Location" document.  To access either the mail file or the journal database, you would need to declare the database object, open the database and then decide what  you wanted to access.

More explanation and suggestions.......................................
Without really looking at this, the example is using generic properties for the local address book.  It's getting a collection of location documents and reading the first one found in the collection.  Which is fine if you have only one location, "Office" and not "island" or "internet"
Otherwise you would need to step through the collection and figure out which is the one that contains the information you need.

What it is trying to do in gettingalldocumentsbykey, it's getting all the location records stored in the address book.  For the most part they all contain similar information, except that an internet location might have different server(thisserver.thisdomain.com) address than your office ocation (thisserver/thisdomain) or different IP addresses for when you inside the building or outside.  So, if it were me collecting the locations, I'd try for the one that closely matching something that said, "office" or the one that is being used by the user.

A better way to find what location is being used is to open the Notes.ini file and collect the environment: Location. - this will tell you the last location used by the user.  Also, it will contain the default directory and the name of the personal address book.

In VB, you would need to troll the registry to find the lotus notes key and then the startup directory.  once you have that, then the notes.ini file is available to give you the last logon location, username and data file path.

Does this make sense, or do you need more information?

0
 
jlalandeAuthor Commented:
I am working on a VoIP application that retrieves the titles (and an identifier for later retrieval) of documents associated with an incoming call.  Because I would like to do this in real-time, I must create a couple of indexes, one from phone numbers to contacts, and the other from contacts to documents where the contact's name appears.

Currently, we do this already with Outlook and would like add Notes support.  I am taking the base classes currently used for the Outlook implementation and making concrete implementations for Notes.  At this point I am working on extracting all the Contacts, Emails, To Do items, Calendar items, and Journal items into a data structure that the indexing mechanism can use.  I have done the work for contacts and emails that are on a server-less deployment of Notes, however I would like to support Notes connected to a Domino server.

When I asked "Is there corresponding values for Contacts, ToDo items, Calendar items and Journal items?" what I was trying to ask is is there a location for the databases that hold these kind of items?  You have answered the question for Journal items.  What is the name of the Journal item in the "Location" document?  More generally, how does one programatically retrieve the names of items from a document?

Do I understand you correctly that the other items (Contacts, ToDo items, Calendar items) are in the mail file?  Can I assume that if I retrieve a collection of more than one location document, that I can also retrieve more than one mail file (hence, more than one set of Contacts, ToDo items, and Calendar items)?

I see a lot of stuff in the notes.ini file, however nothing referring to "default directory" or "personal address book".  Are these items named something else?  And can I retieve these values programatically in the manner than the VB sample does, i.e. szTempString1 = domSession.GetEnvironmentString("Location", True) ?

You have been very helpful.  Though I only asked two questions, I knew that the answers would be large and attempted to assign 1000 points for the answer.  However, I was only allowed 500.

Thanks!
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jlalandeAuthor Commented:
Also, do you know of a good book on this type of programming?
0
 
marilyngCommented:
jLalande, if you can wait a few hours, I will provide more details for you.  Please tell me your notes version, in the meantime.

The mail, todo, calendar are collected from the mail database, along with some contacts,  the remainder of the contacts are collected from the personal address book.  both may have different file names.  the Mail database will have a different filename for each user.  Personal address book may or may not be the same filename for each user, and journal.nsf is usually created by notes, so it is usually the same for each user.
0
 
jlalandeAuthor Commented:
I am using the COM API.  I have Notes 7 installed and I am using it to test with.  I am hoping that my solution will be supported for users with 6.0 and all version in between.

Thanks for your help.
0
 
jlalandeAuthor Commented:
If I capture the contacts that are in the AddressBooks property of the NotesSession object, can I assume I am getting all the contacts available to the user?  The Toolkit documentation describes the AddressBooks property as "both public and personal".
0
 
jlalandeAuthor Commented:
You have helped me immensely...and I am so grateful.  I had no idea of the magnitude of this project.  Thanks for sending me all this information.
0
 
marilyngCommented:
It's actually not too bad with regard to the data mining aspect.  A few forms, and most of the code is looping through the same fields.  You just have to check for duplicates, and with personal address books, hmmm... better tell people ahead of time so they can remove their "personal" stuff..
0
 
jlalandeAuthor Commented:
Well, their personal stuff will stay personal.  This is a user app and the user's indexes will stay private to the user in their AppData folder.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.