Friday, April 10, 2009

Automation on L-Note

Refer to this page: http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/ 1efb1287fc7c27388525642e0074f2b6/1f82ab14864680138525642e007687cb?OpenDocument

I want to create a JS script to list all the mails in the Inbox. As I can't use com object in Python on my workstation. But it failed to get value of "from" while VBS can do the job. I don't have enough time to investigate the root cause, just leave it here for later reference.
'VB script

Set objNotesSession = CreateObject("Lotus.NotesSession")
objNotesSession.Initialize(pwd)
Set objNotesMailFile = objNotesSession.GetDatabase(server, database file)
Set view = objNotesMailFile.GetView("($Inbox)")
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
  WScript.Echo doc.GetItemValue( "From" )(0)
  Set doc = view.GetNextDocument( doc )
Wend
//JavaScript

var s = new ActiveXObject("Lotus.NotesSession");
s.Initialize(pwd);
var db = s.GetDatabase(server, database file);
var v = db.GetView("($Inbox)")
var doc = v.GetFirstDocument();
while (doc) {
  WScript.Echo( doc.LastAccessed );
  doc = v.GetNextDocument(doc);
}

No comments:

Post a Comment