Gets calendar entries within a given time range.
Syntax
java.util.Vector NotesCalendar.getEntries(DateTime start, DateTime end)
throws NotesException
java.util.Vector NotesCalendar.getEntries(DateTime start, DateTime end, int skipcount, int maxreturn)
throws NotesException
Parameter |
Description |
start |
The start time of the entries. |
end |
The end time of the entries. An exception occurs
if the end time is not greater than the start time. |
skipcount |
The number of entries to skip before starting
the get operation. Defaults to 0. |
maxreturn |
The maximum number of entries to return. If skipcount and maxreturn are
not specified, all entries in the range are returned. |
Return value |
Description |
java.util.Vector |
The calendar entries in the range, or an empty
vector for no entries. Each vector element is of type NotesCalendarEntry. |
Usage
Use the last two parameters in conjunction
with EntriesProcessed to process
entries in successive operations. See EntriesProcessed for an example using the
last two parameters.
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)
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 and tomorrow");
RichTextItem body = doc.createRichTextItem("body");
// Get entries and put in body of document
java.util.Vector entries = cal.getEntries(dt1, dt2);
for (int i = 0; i < entries.size(); i++) {
NotesCalendarEntry cale = (NotesCalendarEntry)entries.elementAt(i);
body.appendText(cale.read());
cale.recycle();
body.addNewLine(1);
}
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}