Cumhur Ata
Cumhur Ata

Reputation: 809

How to open first mail of user in user Lotus Notes mail file (nsf file) via Serverside Javascript

When a user logons after then I would like to create a link to reach the first mail of user in XPages via ServerSide Javascript. When the user clicks the links which opens the first mail.

is there any way to make this work?

Regards Cumhur Ata

UPDATE:

var mailDb:NotesDatabase = session.getDatabase(database.getServer(), mailFile);
var mailView:NotesView = mailDb.getView("($Inbox)");
var unreadEntries:NotesViewEntryCollection  = mailView.getAllUnreadEntries();
if (unreadEntries.getCount()>0)
{
    var veUnread:NotesViewEntry = unreadEntries.getFirstEntry();
    var dt:NotesDateTime = veUnread.getDocument().getItemValueDateTimeArray("DeliveredDate").elementAt(0)

    for (var i=0; i<unreadEntries.getCount() && i<3; i++)
    {
        //I can get field values. Find the DeliveredDate below..
        var dt:NotesDateTime = veUnread.getDocument().getItemValueDateTimeArray("DeliveredDate").elementAt(0)
        //I think Where I need to create DocLink is here but not succeded yet :(
        var veUnread:NotesViewEntry = unreadEntries.getNextEntry(veUnread);
    }
}

Upvotes: 0

Views: 95

Answers (1)

stwissel
stwissel

Reputation: 20384

Make it easier. Simply construct the URL from @MailDbName, and /($Inbox)/$first which will open the first document in the inbox. See the URL Command documentation for details

Upvotes: 1

Related Questions