createEntry (NotesCalendar - JavaScript™)
Creates a calendar entry.
Defined in
NotesCalendarSyntax
createEntry(icalentry:string) : NotesCalendarEntry
createEntry(icalentry:string, flags:int) : NotesCalendarEntry
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 AutoSendNotices is 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 button event creates a meeting calendar entry for today at 1600 UTC, and posts its UID to a sessionScope variable.try {
var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var cal:NotesCalendar = session.getCalendar(maildb);
var formatter = new java.text.SimpleDateFormat("yyyyMMdd");
var today:String = formatter.format(new java.util.Date());
var icale:String = "BEGIN:VCALENDAR\n" +
"BEGIN:VEVENT\n" +
"DTSTART:" + today + "T160000Z\n" +
"DTEND" + today + "T170000Z\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";
var calentry:NotesCalendarEntry = cal.createEntry(icale);
requestScope.status = "Create succeeded. UID = " + calentry.getUID();
sessionScope.currentuid = calentry.getUID();
sessionScope.recurid = "";
} catch(e) {
requestScope.status = e.message;
}
try {
var dbdir:NotesDbDirectory = session.getDbDirectory("");
var maildb:NotesDatabase = dbdir.openMailDatabase();
var cal:NotesCalendar = session.getCalendar(maildb);
var formatter = new java.text.SimpleDateFormat("yyyyMMdd");
var today:String = formatter.format(new java.util.Date());
var icale:String = "BEGIN:VCALENDAR\n" +
"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";
var calentry:NotesCalendarEntry = cal.createEntry(icale, NotesCalendar.CS_WRITE_DISABLE_IMPLICIT_SCHEDULING);
var calentrystr:String = calentry.read();
requestScope.status = "Create succeeded. UID = " + calentry.getUID();
sessionScope.currentuid = calentry.getUID();
sessionScope.currentrecurid = today + "T160000Z";
} catch(e) {
requestScope.status = e.message;
}
LotusScript® syntax and examples
NotesCalendar.CreateEntry(Byval icalentry As String, Optional flags As Integer) As NotesCalendarEntry
This
agent creates a meeting calendar entry for today and tomorrow at 1600
UTC, with no notices being sent, and posts its UID and the first recurrence
identifier to sessionScope variables.Sub Initialize
Dim session As New NotesSession
Dim maildb As New NotesDatabase("", "")
Dim cal As NotesCalendar
Dim calentry As NotesCalendarEntry
Dim icale As String
Dim tday As String
REM Get calendar for current user and create entry
Call maildb.Openmail()
Set cal = session.getCalendar(maildb)
tday = Format(Today, "yyyymmdd")
icale = |BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:| & tday & |T160000Z
DTEND:| & tday & |T170000Z
RRULE:FREQ=DAILY;COUNT=2
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN="Roberta Person/Westford/IBM";
RSVP=FALSE:mailto:roberta_person@us.ibm.com
ATTENDEE;ROLE=REQ-PARTICIPANT
;CN="Doc Test/Bedford/IBM";RSVP=TRUE:mailto:doctest@us.ibm.com
SUMMARY:Sample Meeting
ORGANIZER;CN="Roberta Person/Westford/IBM"
:mailto:roberta_person@us.ibm.com
END:VEVENT
END:VCALENDAR|
Set calentry = cal.Createentry(icale, Cs_write_disable_implicit_scheduling)
Call session.Setenvironmentvar("currentuid", calentry.Uid)
Call session.Setenvironmentvar("currentrecurid", tday & "T160000")
MessageBox "UID = " & calentry.Uid,, "Created calendar entry"
End Sub
Java™ syntax and examples
NotesCalendarEntry NotesCalendar.createEntry(String icalentry)
NotesCalendarEntry NotesCalendar.createEntry(String icalentry, int flags)
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" +
"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();
}
}
}