.

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: getNthDocument method
This agent demonstrates a function that gets a document in a document collection specified by number.

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();
     DocumentCollection dc = db.getAllDocuments();
     int N = 3;
     printDocument(dc, N);
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
 void printDocument(DocumentCollection dc, int n) {
   try {
     if (n < 0 || n > dc.getCount())
       System.out.println("N out of range");
     else
       System.out.println("Doc #" + n + ": " +
       dc.getNthDocument(n).getItemValueString("Subject"));
   
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also