getEntry (NotesCalendar - Java)

Gets a calendar entry.

Defined in

NotesCalendar

Syntax

NotesCalendarEntry NotesCalendar.getEntry(String uid)
	throws NotesException
Parameter Description
uid The iCalendar identifier (UID item) of the entry.
Return value Description
NotesCalendarEntry The calendar entry. No exception occurs for this method if the identifier is invalid. However, when you attempt to use the returned NotesCalendarEntry object, the following exception occurs: Entry not found in index.

Usage

This method does not verify uid except for its existence. Validity checking and error reporting occur when you attempt to use the returned NotesCalendarEntry object.

Examples

This agent gets the calendar entry for a UID saved as an environment variable.
import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

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

          // (Your code goes here)
          DbDirectory dbdir = session.getDbDirectory("");
          Database maildb = dbdir.openMailDatabase();
          // Create document to post results
          Database db = agentContext.getCurrentDatabase();
          Document doc = db.createDocument();
          doc.appendItemValue("Form", "main");
          doc.appendItemValue("subject", "Calendar entry");
          RichTextItem body = doc.createRichTextItem("body");
          // Get entry and put in body of document
          String uid = session.getEnvironmentString("currentuid");
          if (uid != null) {
              NotesCalendar cal = session.getCalendar(maildb);
              body.appendText("Calendar entry for UID " + uid + "\n");
              body.appendText(cal.getEntry(uid).read());
          } else {
        	  body.appendText("Current UID not set");
          }
          doc.save(true, true);

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