createEntry (NotesCalendar - Java)
Creates a calendar entry.
Defined in
NotesCalendarSyntax
NotesCalendarEntry NotesCalendar.createEntry(String icalentry)
throws NotesException
NotesCalendarEntry NotesCalendar.createEntry(String icalentry, int flags)
throws NotesException
Parameter | Description |
---|---|
icalentry |
Input for one calendar entry in iCalendar format. |
flags |
Write flag.
|
Return value | Description |
---|---|
NotesCalendarEntry |
The calendar entry. |
Possible exception | Value | Text | Description |
---|---|---|---|
NotesError.NOTES_ERR_ERRSENDINGNOTICES |
4809 | Error sending notices | A problem occurred sending out notices for a meeting. You may want to update the meeting again. |
NotesError.NOTES_ERR_ENTRYEXISTS |
4815 | Entry already exists | The entry exists in the calendar. |
Usage
An exception occurs if the input is invalid. SeeInternet Calendaring and Scheduling Core Object Specification
(iCalendar)
at http://tools.ietf.org/html/rfc5545 for
the format, or use the output from a read operation as a template.
The examples show basic formatting for an appointment and a meeting.If
problems persist, try running with the following notes.ini
variable: CSDebugAPI=1
.
When the exception occurs, check the console log for details.
For
a meeting, if AutoSendNoticesis not set to false and NotesCalendar.CS_WRITE_DISABLE_IMPLICIT_SCHEDULING
is
not set, notices are automatically sent to participants.
If icalentry
contains
a recurrence rule (RRULE
item), this method creates
a calendar event for each recurrence with its own identifier (RECURRENCE-ID
item).
The format of a recurrence identifier is the time of the event in
UTC format, for example, 20120913T160000Z
. However,
if you later change the time of the event, the identifier does not
change.
Examples
This agent creates a meeting calendar entry for today and tomorrow at 1600 UTC, with no notices being sent, and posts its UID to 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();
NotesCalendar cal = session.getCalendar(maildb);
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyyMMdd");
String today = formatter.format(new java.util.Date());
String icale = "BEGIN:VCALENDAR\n" +
"PRODID:-//Test Suite//OpenNTF 1.0//EN"
"BEGIN:VEVENT\n" +
"DTSTART:" + today + "T160000Z\n" +
"DTEND:" + today + "T170000Z\n" +
"RRULE:FREQ=DAILY;COUNT=2\n" +
"ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=\"Roberta Person/Westford/IBM\";\n" +
" RSVP=FALSE:mailto:roberta_person@us.ibm.com\n" +
"ATTENDEE;ROLE=REQ-PARTICIPANT\n" +
" ;CN=\"Doc Test/Bedford/IBM\";RSVP=TRUE:mailto:doctest@us.ibm.com\n" +
"SUMMARY:Sample Meeting\n" +
"ORGANIZER;CN=\"Roberta Person/Westford/IBM\"\n" +
" :mailto:roberta_person@us.ibm.com\n" +
"END:VEVENT\n" +
"END:VCALENDAR\n";
NotesCalendarEntry calentry = cal.createEntry(icale, NotesCalendar.CS_WRITE_DISABLE_IMPLICIT_SCHEDULING);
session.setEnvironmentVar("currentuid", calentry.getUID());
session.setEnvironmentVar("currentrecurid", today + "T160000");
} catch(Exception e) {
e.printStackTrace();
}
}
}