getEntry (NotesCalendar - JavaScript)

Gets a calendar entry.

Defined in

NotesCalendar

Syntax

getEntry(uid:string) : NotesCalendarEntry
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 button event gets the calendar entry for a UID saved as a sessionScope variable.
try {

var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var cal:NotesCalendar = session.getCalendar(maildb);
var uid:string = sessionScope.currentuid;
var cale:NotesCalendarEntry = cal.getEntry(uid);
requestScope.status = "Calendar entry for UID " + uid + "\n";
requestScope.status = requestScope.status + cale.read();

} catch(e) {
	requestScope.status = "Cannot locate calendar entry with UID " + sessionScope.currentuid;
}

LotusScript® syntax and examples

NotesCalendar.GetEntry(Byval uid As String) As NotesCalendarEntry
This agent gets the calendar entry for a UID saved as an environment variable.
Sub Initialize
	Dim session As New NotesSession
	Dim maildb As New NotesDatabase("", "")
	Dim uid As String
	Dim cal As NotesCalendar
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim body As NotesRichTextItem
	REM Get calendar for current user
	Call maildb.Openmail()
	Set cal = session.getCalendar(maildb)
	REM Create document to post results
	Set db = session.CurrentDatabase
	Set doc = db.CreateDocument
	doc.Form = "main"
	doc.Subject = "Calendar entry"
	Set body = doc.Createrichtextitem("body")
	REM Get entry and put in body of document
	uid = session.Getenvironmentstring("currentuid")
	If uid = "" Then
		body.Appendtext("Current UID not set")
	Else
		body.Appendtext("Calendar entry for UID " & uid)
		body.Addnewline(1)
		body.Appendtext(cal.Getentry(uid).Read())
	End If
	Call doc.Save( True, True )
End Sub

Java syntax and examples

NotesCalendarEntry NotesCalendar.getEntry(String uid)
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();
       }
   }
}