Florin Pop
Florin Pop

Reputation: 5135

Xpages Email & Calendar open in browser

I want to have an option to my application to open the email & calendar from a tag. I have added this code that I've found:

try {

var db:NotesDatabase = session.getDbDirectory("D:/IBM/Notes/Data/").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();
} 

It's seem that something is wrong.

Thank you,

Florin

Upvotes: 1

Views: 145

Answers (1)

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

The getDbDirectory() method expects a server name as parameter (and not a absolute path). So try this instead:

try {    
    var db:NotesDatabase = session.getDbDirectory("servername/organization").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();
}

Upvotes: 1

Related Questions