0
votes

I'm searching for a way to access the calendar and email inbox of another user (I can access my own calendar/email without any problems). Currently I can access the other inbox/calendar via lotus notes (I have enough rights). But I couldn't manage it to access the data programmatically.

I already listed all my views, but there was nothing appropriated.

private Domino.NotesDatabase db;

Object[] docColl = this.db.Views as Object[];

foreach (Object objView in docColl)
{
   NotesView view = objView as NotesView;
   this.WriteToLog(view.Name);
}

Any ideas, if this is possible and how?

2

2 Answers

2
votes

Every Notes user's mail box is in a separate database.

So, first you have to get the database with

Domino.NotesDatabase db = 
              session.GetDatabase("yourServer", "UserMail.nsf", false);

and there you can access the calendar and email folders.

1
votes

@Knut's answer gives you the basic information that you need, but I'd like to clarify it a bit: it has to be the hisServer (or herServer), not yourServer. Also, it will usually be "mail\hisShortname.nsf"), but that's not always the case. The point is that if you are trying to write generalized code, you have to look these things up in the Domino Directory.

If you're using a recent version of the Notes APIs, the best way to proceed is by using session.getDirectory(myServer) to get a NotesDirectory object. (It doesn't matter what server you use in this case, as long as the users are in the same Notes domain.) Here's the doc for the getDirectory method.

Once you have a handle to the Domino Directory, you need to look up information for the Person whose mail file you want to access. The formal documentation for the NotesDirectory class seems to be frustratingly hard to find online every time I search for it, so I can't link to that. The second example in the first section of this wiki page shows a call to the LookupNames method to retrieve information for a Person object, which is what you need to do. The two items that you want to retrieve are "MailServer" and "MailFile".