getCalendar (Session - Java)

Creates a new NotesCalendar object.

Defined in

NotesSession

Syntax

NotesCalendar Session.getCalendar(Database maildatabase)
	throws NotesException
Parameter Description
maildatabase A standard Domino® mail application, for example, an application based on the template StdR85Mail.
Return value Description
NotesCalendar The newly created NotesCalendar object.

Usage

For more information, see NotesCalendar.

Examples

This agent gets calendar and scheduling information for the current user for today and tomorrow.
import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();

          // (Your code goes here)
          // Get calendar for current user
          DbDirectory dbdir = session.getDbDirectory("");
          Database maildb = dbdir.openMailDatabase();
          NotesCalendar cal = session.getCalendar(maildb);
          DateTime dt1 = session.createDateTime("Today 08");
          DateTime dt2 = session.createDateTime("Tomorrow 17");
          // Create document to post results
          Database db = agentContext.getCurrentDatabase();
          Document doc = db.createDocument();
          doc.appendItemValue("Form", "main");
          doc.appendItemValue("subject", "Today 08");
          RichTextItem body = doc.createRichTextItem("body");
          // Read range and put in body of document
          body.appendText(cal.readRange(dt1, dt2));
          doc.save(true, true);

      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}