Your mailbox gets a meeting notice when someone takes any of the following actions:
The information provided by the cfexchangemail tag with the get action does not provide detailed information about meeting. It only includes the following meeting-related information:
Also, a meeting request does not appear in your calendar (so you cannot get detailed information about it using the cfexchangecalendar tag) until you accept it.
To get detailed information about a meeting message, you must use the cfexchangemail tag with the getMeetingInfo action. After getting the information, you can take the necessary action, such as using an cfexchangecalendar tag with the response action to accept or decline a meeting request.
Get meeting message details and respond to meeting requests
The following example shows how you can use this process. It displays all meeting invitations in the Inbox and lets the user respond to each request and send a message with the response:
<cfexchangeconnection action="open" username ="#user2#" password="#password2#" server="#exchangeServerIP#" connection="conn1"> <cfif isDefined("Form.Submit")> <!--- When the form has been submitted, send the responses. ---> <cfloop index="k" from="1" to="#Form.responses#"> <cfset resp = Form["response" & k] > <cfset msg = Form["respMessage" & k] > <cfset msguid = Form["UID" & k] > <cfexchangecalendar action="respond" connection="conn1" uid="#msguid#" responseType="#resp#" message="#msg#"> <cfoutput><h4>Response #k# sent!</h4></cfoutput> </cfloop> <cfelse> <!--- Get all messages with meeting Requests. ---> <cfexchangemail action="get" name="requests" connection="conn1"> <cfexchangefilter name="MessageType" value="Meeting_Request"> </cfexchangemail> <!--- Get the meeting request data. ---> <cfloop query="requests"> <cfexchangemail action="getmeetinginfo" connection="conn1" name="meeting" meetinguid="#MeetingUID#"> <cfset meetingData[requests.currentrow]=meeting> </cfloop> <!--- Display the invitation data in a form. ---> <cfform name="bar"> <cfloop index="j" from="1" to="#ArrayLen(meetingData)#"> <cfoutput> <h3>Meeting Request #j#</h3> Subject: #meetingData[j].Subject# <br /> Sensitivity: #meetingData[j].Sensitivity# <br /> Organizer: #meetingData[j].Organizer# <br /> All Day?: #meetingData[j].AllDayEvent# <br /> Day: #DateFormat(meetingData[j].StartTime)# Starts: #TimeFormat(meetingData[j].StartTime)# Ends: #TimeFormat(meetingData[j].EndTime)# <br /> Duration: #meetingData[j].Duration# <br /> Location: #meetingData[j].Location# <br /> Message: #meetingData[j].Message# <br /> </cfoutput> <!--- Specify the response to this invitation. ---> <h4>response:</h4> <cfinput type="radio" checked name="response#j#" value="accept"> Accept <cfinput type="radio" name="response#j#" value="decline">Decline <cfinput type="radio" name="response#j#" value="tentative">Tentative <br /> <cftextarea name="respMessage#j#" label="Message (optional)" width="300" height="200" /> <cfinput type="hidden" name="UID#j#" value="#meetingData[j].MeetingUID#"> <hr /> </cfloop> <cfinput type="hidden" name="responses" value="#ArrayLen(meetingData)#"> <cfinput type="Submit" name="submit" value="Submit"> </cfform> </cfif> <cfexchangeconnection action="close" connection="conn1">
For an example that gets information about all declined meeting messages in the Inbox and all its subfolders, see the example in Getting and using folder names.
To create an event that recurs multiple times, you specify the following fields in the event attribute structure:
To change an event recurrence, including to change whether the event recurs, you specify only the fields whose values change. To stop an event from recurring, set the IsRecurring field to false. To convert an event from nonrecurring to recurring, set the IsRecurring field to true and set all the necessary recurrence fields.
The following sections describe how to specify each type of recurrence. For detailed descriptions of the fields that you use, see cfexchangecalendar in the CFML Reference.
To set a recurrence that is based on days, you do one of the following:
You cannot use daily recurrence to schedule a single event that occurs a multiple number of times, but only on week days. To schedule such an event, specify a weekly recurrence with multiple recurrence days.
The following CFScript code sample sets daily recurrence for every 3 days and sets the event to occur 20 times:
IsRecurring="true"; RecurrenceType="DAILY"; RecurrenceCount="20"; RecurrenceFrequency="3";
You can create an event that always occurs on the same day or days of the week, and occurs every week or every several weeks by specifying RecurrenceType="WEEKLY". You use the following fields to control the frequency:
The following CFScript code sample sets an event that occurs on Tuesday and Thursday of every other week until December 3, 2007.
IsRecurring="true"; RecurrenceType="WEEKLY"; RecurrenceEndDate="12/13/2007"; RecurrenceFrequency="2"; RecurrenceDays="TUE,THU;
You can create an event that always occurs on a monthly basis, or occurs every several months by specifying RecurrenceType="MONTHLY". You can schedule two types of events:
To specify a date-based monthly event, you only specify the recurrence type, and, if the recurrence is not every month, the frequency. ColdFusion schedules the event to occur on the day of the week determined by the startTime field value. To schedule a meeting that occurs on the start date every 4 months, specify the following recurrence fields:
IsRecurring="true"; RecurrenceType="MONTHLY"; RecurrenceFrequency="4";
To specify an event that occurs on the same day of the week, specify the following fields in addition to RecurrenceType:
Field |
Description |
---|---|
RecurrenceFrequency |
The frequency of the event, in months. If you omit this field, the event occurs every month. |
RecurrenceWeek |
The week of the month on which the event occurs. Valid values are first, second, third, fourth, and last. |
RecurrenceDay |
The day of the week on which the event occurs. Valid values are SUN, MON, TUE, WED, THU, FRI, and SAT. |
The following CFScript code sample sets an event that occurs on the third Thursday of every three months:
IsRecurring="true"; RecurrenceType="Monthly"; RecurrenceFrequency="3"; RecurrenceWeek="third"; RecurrenceDay="THU";
You can create an event that always occurs on a yearly basis by specifying RecurrenceType="YEARLY". You can schedule two types of events:
To specify a date-based yearly event, you only specify the recurrence type. ColdFusion schedules the event to occur each year on the date determined by the startTime field value. To schedule a meeting that occurs on the start date every year, specify the following recurrence fields:
IsRecurring="true"; RecurrenceType="YEARLY";
To specify an event that occurs on the same day of the week and month each year, specify the following fields in addition to RecurrenceType:
Field |
Description |
---|---|
RecurrenceMonth |
The month of the year which the event occurs. Valid values are JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, and DEC. |
RecurrenceWeek |
The week of the month during which the event occurs. Valid values are first, second, third, fourth, and last. |
RecurrenceDay |
The day of the week on which the event occurs. Valid values are SUN, MON, TUE, WED, THU, FRI, and SAT. |
The following CFScript code sample sets an event that occurs on the third Thursday of August three months:
IsRecurring="true"; RecurrenceType="YEARLY"; RecurrenceMonth="AUG"; RecurrenceWeek="third"; RecurrenceDay="THU";
Example: Setting calendar recurrence
The following example lets you create events with all types of recurrence. To limit the code length, it does not prevent you from attempting to create events with invalid field combinations. When you submit the form, if an event is created, the form redisplays, preceded by a dump that shows the field values that were used to create the event, and the event UID. You cannot resubmit the form to modify the event, but you can change some values in the form and create an event.
<!--- Create a structure to hold the event information. ---> <cfparam name="form.eventID" default="0"> <!--- If the form was submitted, populate the event structure from it. ---> <cfif isDefined("Form.Submit")> <cfscript> sEvent.AllDayEvent="false"; sEvent=StructNew(); sEvent.Subject=Form.subject; if (IsDefined("Form.allDay")) { sEvent.AllDayEvent="true"; sEvent.StartTime=createDateTime(Year(Form.date), Month(Form.date), Day(Form.date), 8, 0, 0); } else { sEvent.StartTime=createDateTime(Year(Form.date), Month(Form.date), Day(Form.date), Hour(Form.startTime), Minute(Form.startTime), 0); sEvent.EndTime=createDateTime(Year(Form.date), Month(Form.date), Day(Form.date), Hour(Form.endTime), Minute(Form.endTime), 0); } sEvent.Location=Form.location; sEvent.RequiredAttendees=Form.requiredAttendees; sEvent.OptionalAttendees=Form.optionalAttendees; //sEvent.Resources=Form.resources; if (Form.reminder NEQ "") { sEvent.Reminder=Form.reminder; } else { sEvent.Reminder=0; } sEvent.Importance=Form.importance; sEvent.Sensitivity=Form.sensitivity; //Recurrence Fields if (IsDefined("Form.isRecurring")) { sEvent.IsRecurring="true";} if (IsDefined("Form.recurrenceNoEndDate")) { sEvent.RecurrenceNoEndDate="true";} if (Form.recurrenceCount NEQ "") { sEvent.RecurrenceCount=Form.recurrenceCount;} if (Form.recurrenceEndDate NEQ "") { sEvent.RecurrenceEndDate=createDateTime(Year(Form.recurrenceEndDate), Month(Form.recurrenceEndDate), Day(Form.recurrenceEndDate), 0, 0, 0);} sEvent.RecurrenceType=Form.recurrenceType; if (Form.recurrenceFrequency NEQ "") { sEvent.recurrenceFrequency=Form.recurrenceFrequency;} if (IsDefined("Form.recurEveryWeekDay")) { sEvent.RecurEveryWeekDay="true";} if (Form.recurrenceDays NEQ "") { sEvent.RecurrenceDays=Form.recurrenceDays;} if (Form.recurrenceDay NEQ "") { sEvent.RecurrenceDay=Form.recurrenceDay;} if (Form.recurrenceWeek NEQ "") { sEvent.RecurrenceWeek=Form.recurrenceWeek;} if (Form.recurrenceMonth NEQ "") { sEvent.RecurrenceMonth=Form.recurrenceMonth;} sEvent.message=Form.Message; </cfscript> <cfdump var="#sEvent#"> <!--- Create the event in Exchange. ---> <cfexchangecalendar action="create" username ="#user1#" password="#password1#" server="#exchangeServerIP#" event="#sEvent#" result="theUID"> <!--- Output the UID of the new event ---> <cfif isDefined("theUID")> <cfoutput>Event Added. UID is#theUID#</cfoutput> <cfset Form.eventID = theUID > </cfif> </cfif> <cfform format="xml" preservedata="true" style="width:500" height="700"> <cfinput type="text" label="Subject" name="subject" style="width:435"> <br /> <cfinput type="checkbox" label="All Day Event" name="allDay"> <cfinput type="datefield" label="Date" name="date" validate="date" style="width:100"> <cfinput type="text" label="Start Time" name="startTime" validate="time" style="width:100"> <cfinput type="text" label="End Time" name="endTime" validate="time" style="width:100"><br /> <cfinput type="text" label="Location" name="location" style="width:435"><br /> <cfinput type="text" label="Required Attendees" name="requiredAttendees" style="width:435"><br /> <cfinput type="text" label="Optional Attendees" name="optionalAttendees" style="width:435"><br /> <cfinput type="text" label="Resources" name="resources" style="width:435"><br /> <cfinput type="text" label="Reminder (minutes)" validate="integer" name="reminder" style="width:200"> <cfselect name="importance" label="Importance" style="width:100"> <option value="normal">Normal</option> <option value="high">High</option> <option value="low">Low</option> </cfselect> <cfselect name="sensitivity" label="Sensitivity" style="width:100"> <option value="normal">Normal</option> <option value="company-confidential">Confidential</option> <option value="personal">Personal</option> <option value="private">Private</option> </cfselect> <hr /> <!--- Recurrence Information ---> <cfinput type="checkbox" label="IsRecurring" name="isRecurring"> <cfinput type="checkbox" label="RecurrenceNoEndDate" name="noEndDate"> <cfinput type="text" label="RecurrenceCount" validate="integer" required="false" name="recurrenceCount"> <cfinput type="text" label="RecurrenceEndDate" validate="date" required="false" name="recurrenceEndDate"> <cfselect name="RecurrenceType" label="Recurrence Type" style="width:100"> <option value="DAILY">Daily</option> <option value="WEEKLY">Weekly</option> <option value="MONTHLY">Monthly</option> <option value="YEARLY">Yearly</option> </cfselect> <cfinput type="text" label="RecurrenceFrequency" validate="integer" name="recurrenceFrequency"> <cfinput type="checkbox" label="RecurEveryWeekDay" name="recurEveryWeekDay"> <cfinput type="text" label="RecurrenceDays" name="recurrenceDays"> <cfinput type="text" label="RecurrenceDay" name="recurrenceDay"> <cfselect name="RecurrenceWeek" label="RecurrenceWeek" style="width:100"> <option value=""></option> <option value="first">First</option> <option value="second">Second</option> <option value="third">Third</option> <option value="fourth">Fourth</option> <option value="last">Last</option> <cfinput type="text" label="RecurrenceMonth" name="recurrenceMonth"> </cfselect> <hr /> <cfinput type="textarea" label="Message" name="message" style="width:300; height:100"> <cfinput type="Submit" name="submit" value="Submit" > </cfform>