getNewInvitations (NotesCalendar - JavaScript™)
Gets calendar entries that are new invitations.
Defined in
NotesCalendarSyntax
getNewInvitations() : java.util.Vector
getNewInvitations(start:NotesDateTime, since:NotesDateTime)
: java.util.Vector
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 button event gets calendar invitations for messages starting on January 1, 2012, and invitations since yesterday at 2:00 AM or the last time the button was used during the session.var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var cal:NotesCalendar = session.getCalendar(maildb);
var jdt:java.util.Calendar = new java.util.Calendar.getInstance();
jdt.set(2012, 1, 1, 1, 1, 1);
var dt1:NotesDateTime = session.createDateTime(jdt);
if (sessionScope.untilTime == null) {
var dt2:NotesDateTime = session.createDateTime("Yesterday 02");
} else {
var dt2:NotesDateTime = session.createDateTime(sessionScope.untilTime);
}
requestScope.status = dt2.getLocalTime() + "\n";
var invites:java.util.Vector = cal.getNewInvitations(dt1, dt2);
sessionScope.untilTime = cal.getUntilTime().getLocalTime();
if (invites.size() > 0) {
for (i = 0; i < invites.size(); i++) {
requestScope.status = requestScope.status + invites.elementAt(i).read() + "\n";
}
} else {
requestScope.status = requestScope.status + "No invitations\n";
}
LotusScript® syntax and examples
NotesCalendar.GetNewInvitations(Optional start As NotesDateTime, Optional since As NotesDateTime) As Variant
This
agent gets calendar invitations for messages starting on January 1,
2012, and invitations since October 1 at midnight. The agent then
gets more invitations since the last one processed as the user desires.Sub Initialize
REM On Error GoTo handler
Dim session As New NotesSession
Dim maildb As New NotesDatabase("", "")
Dim cal As NotesCalendar
Dim dt1 As NotesDateTime
Dim dt2 As NotesDateTime
Dim invites As Variant
Call maildb.Openmail()
Set cal = session.getCalendar(maildb)
Set dt1 = session.createdatetime("01/01/2012 00:00 AM")
Set dt2 = session.createdatetime("10/01/2012 00:00 AM")
invites = cal.Getnewinvitations(dt1, dt2)
Do
If IsEmpty(invites) Then
MessageBox "No invitations",, "Nothing"
Else
Dim invite As NotesCalendarNotice
Dim i As Integer
On Error Resume Next
For i = LBound(invites) To UBound(invites)
Set invite = invites(i)
MessageBox invite.Read(),, "Invitation"
Next
End If
if (MessageBox(|Do you want to get new invitations since | & _
cal.Untiltime.Localtime & |?|, MB_YESNO, "Again?") = IDNO) Then
Exit do
End if
invites = cal.Getnewinvitations(dt1, cal.Untiltime)
Loop
Exit Sub
handler:
MsgBox Error,, Err()
Exit sub
End Sub
Java™ syntax and examples
java.util.Vector NotesCalendar.getNewInvitations()
java.util.Vector NotesCalendar.getNewInvitations(DateTime start, DateTime since)
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();
}
}
}