UntilTime (NotesCalendar - JavaScript)

Read-only. Specifies the time of the last invitation processed by getNewInvitations.

Defined in

NotesCalendar

Syntax

getUntilTime() : NotesDateTime

Usage

This property is set by getNewInvitations. It can be used as the second parameter to getNewInvitations to get invitations posted since the last call.

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.UntilTime As NotesDateTime
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

DateTime NotesCalendar.getUntilTime()
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();
      }
   }
}