Renders a calendar entry in iCalendar
format.
Syntax
String NotesCalendarEntry.read()
throws NotesException
String NotesCalendarEntry.read(String recurid)
throws NotesException
Parameter |
Description |
recurid |
The recurrence identifier (RECURRENCE-ID item)
for a recurring calendar event. The format of a recurrence identifier
is a time in UTC format, for example, 20120913T160000Z . |
Return value |
Description |
String |
The calendar entry in iCalendar format. |
Possible exception |
Value |
Text |
Description |
NotesError.NOTES_ERR_INVALIDID |
4757 |
Invalid ID |
The identifier for the NotesCalendarEntry object is not valid. |
NotesError.NOTES_ERR_RECURID_NOTFOUND |
4808 |
Recurrence-ID not found |
The recurrence identifier for the NotesCalendarEntry object is not valid. |
NotesError.NOTES_ERR_IDNOTFOUND |
4814 |
Identifier not found |
The recurrence identifier for the NotesCalendarEntry object does not identify
an entry in the calendar, or the scope and recurid are
missing for a recurring entry. |
Usage
This method returns complete iCalendar
data
for the entry. For recurring entries, the data may contain multiple VEVENT
entries.
Examples
This agent reads the calendar entry
for a given UID, or its first instance in the case of a recurring
entry.import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
String uid = session.getEnvironmentString("currentuid");
String calestr = "";
if (uid != null) {
DbDirectory dbdir = session.getDbDirectory("");
Database maildb = dbdir.openMailDatabase();
NotesCalendar cal = session.getCalendar(maildb);
NotesCalendarEntry cale = cal.getEntry(uid);
String recurid = session.getEnvironmentString("currentrecurid");
if (recurid == null || recurid.length() == 0) {
calestr = cale.read();
} else {
calestr = cale.read(recurid);
}
} else {
calestr = "Null UID";
}
// Write result to document
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.appendItemValue("Form", "main");
doc.appendItemValue("subject", "Calendar entry");
RichTextItem body = doc.createRichTextItem("body");
body.appendText(calestr);
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}