openMailDatabase (NotesDbDirectory - JavaScript)

Opens the current user's mail database.

Defined in

NotesDbDirectory

Syntax

openMailDatabase() : NotesDatabase
Return value Description
NotesDatabase The opened database. An exception occurs if the mail database cannot be opened.

Examples

This button collects statistics on the current user's mail database.
try {

var db:NotesDatabase = session.getDbDirectory("NotesUA/Westford/Notes").openMailDatabase();
var dc:NotesDocumentCollection = db.getAllDocuments();
requestScope.status = "Mail database " + db.getTitle() + " is " +
(db.getSize()/1024).toFixed() + "KB long and has " + dc.getCount() + " documents";

} catch(e) {
	requestScope.status = "Error opening mail database\n" + e.toString();
}