.

HCLSoftware Business Partner
Domino Consulting Services
CRUCIAL Notes Tools
+1 212-599-2048

Domino Consulting Services
CRUCIAL Notes Tools
Domino administration
Notes development

Facebook Twitter YouTube
Chat now       
.
ProductsDownloadsNewsAbout usContact


Need a Domino Consultant? Call NotesMail +1 212-599-2048 - HCLSoftware Business Partner

JAVA/CORBA CLASSES


Examples: logError method
This agent searches for "Rocks" in the documents in the current database and logs an error message to logerror.log in the current Domino directory if no occurrences are found.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext = session.getAgentContext();
     // (Your code goes here)
     Database db = agentContext.getCurrentDatabase();
     Log log = session.createLog("Geology Agent");
     log.openFileLog("logerror.log");
     DocumentCollection dc = db.FTSearch("Rocks", 0);
     if (dc.getCount() == 0) {
       log.logError(0, "No documents found"); }
     else {
       Newsletter news = session.createNewsletter(dc);
       news.setSubjectItemName("Subject");
       Document doc = news.formatMsgWithDoclinks(db);
       doc.appendItemValue("Form", "Memo");
       doc.appendItemValue("Subject", "The Rock Report");
       doc.send(false, session.getUserName()); }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also