Gets a calendar entry given its universal identifier (UNID).
Syntax
NotesCalendarEntry NotesCalendar.getEntryByUNID(String unid)
throws NotesException
Parameter |
Description |
unid |
The universal identifier (UNID) of the Domino® document containing the
entry. |
Return value |
Description |
NotesCalendarEntry |
The calendar entry. An exception occurs if the
identifier is invalid. |
Examples
This agent gets a calendar entry using
the UNID for a document from the ($Calendar)
view
in the mail database of the current user.import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
// calentry environment variable must be previously set
Integer n = (Integer)session.getEnvironmentValue("calentry");
DbDirectory dbdir = session.getDbDirectory("");
Database maildb = dbdir.openMailDatabase();
View calview = maildb.getView("($Calendar)");
Document caldoc = calview.getNthDocument(n.intValue());
// 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
if (caldoc != null) {
String unid = caldoc.getUniversalID();
NotesCalendar cal = session.getCalendar(maildb);
body.appendText("Calendar entry for UNID " + unid + "\n");
body.appendText(cal.getEntryByUNID(unid).read());
} else {
body.appendText("Calendar entry out of range");
}
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}