Gets calendar entries that are new invitations.
Syntax
java.util.Vector NotesCalendar.getNewInvitations()
throws NotesException
java.util.Vector NotesCalendar.getNewInvitations(DateTime start, DateTime since)
throws NotesException
Parameter |
Description |
start |
The start time for meetings to which any new
invitations apply. Defaults to all meetings. |
since |
The since time for any new invitations. Defaults
to all new invitations. Use this parameter in conjunction with UntilTime to get invitations posted since
the last call. |
Return value |
Description |
java.util.Vector |
The new invitations, or an empty vector for
no invitations. Each vector element is of type NotesCalendarNotice. |
Usage
It is important to remember that:
- The first parameter applies to meetings and specifies the first
date to be included in the search.
- The second parameter applies to invitations and specifies the
last date to be excluded from the search.
Examples
This agent gets calendar invitations
for messages starting on January 1, 2012 three times, 30 minutes apart.
The first call gets invitations since yesterday at 2:00 AM. The next
two calls get invitations since the last one processed.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);
java.util.Calendar jdt = java.util.Calendar.getInstance();
jdt.set(2012, 1, 1, 1, 1, 1);
DateTime dt1 = session.createDateTime(jdt);
DateTime dt2 = session.createDateTime("Yesterday 02");
java.util.Vector invites = cal.getNewInvitations(dt1, dt2);
Database db = agentContext.getCurrentDatabase();
for (int j = 0; j < 3; j++) {
// Create document to post results
Document doc = db.createDocument();
doc.appendItemValue("Form", "main");
doc.appendItemValue("subject", "New invitations");
RichTextItem body = doc.createRichTextItem("body");
if (invites.size() == 0) body.appendText("No invitations");
else {
for (int i = 0; i < invites.size(); i++) {
NotesCalendarNotice cale = (NotesCalendarNotice)invites.elementAt(i);
body.appendText(cale.read());
cale.recycle();
body.addNewLine();
}
}
doc.save(true, true);
java.util.concurrent.TimeUnit.MINUTES.sleep(30);
invites = cal.getNewInvitations(dt1, cal.getUntilTime());
}
} catch(Exception e) {
e.printStackTrace();
}
}
}