cfexchangecalendar

Description

Creates, deletes, modifies, gets, and responds to Microsoft Exchange calendar events, and gets calendar event attachments.

Categories

Related

History

ColdFusion 8: Added this tag.

Syntax

create  
<cfexchangecalendar 
    required  
    action = "create" 
    event = "#event information structure#" 
    optional  
    connection = "connection ID" 
    result = "variable for event UID"> 
 
delete  
<cfexchangecalendar 
    required  
    action = "delete" 
    uid = "event UID,event UID, ..." 
    optional  
    connection = "connection ID" 
    message = "string" 
    notify = "yes|no"> 
 
deleteAttachments  
<cfexchangecalendar 
    required  
    action = "deleteAttachments" 
    uid = "event UID" 
    optional  
    connection = "connection ID"> 
 
get  
<cfexchangecalendar 
    required  
    action = "get" 
    name = "query identifier" 
    optional  
    connection = "connection ID"> 
 
getAttachments  
<cfexchangecalendar 
    required  
    action = "getAttachments" 
    name = "query identifier" 
    uid = "event UID" 
    optional  
    attachmentPath = "directory path" 
    connection = "connection ID"> 
    generateUniqueFilenames = "no|yes" 
 
modify 
<cfexchangecalendar 
    required  
    action = "modify" 
    event = "#event information structure#" 
    uid = "event UID" 
    optional  
    connection = "connection ID"> 
 
respond 
<cfexchangecalendar 
    required  
    action = "respond" 
    responseType = "accept|decline|tentative" 
    uid = "event UID" 
    optional  
    connection = "connection ID" 
    message = "string"> 
    notify = "yes|no">
Note: For all actions, see cfexchangeconnection for additional attributes that you use if you do not specify the connection attribute. If you omit the connection attribute, create a temporary connection by specifying cfexchangeconnection tag attributes in the cfexchangecalendar tag. In this case, ColdFusion closes the connection when the tag completes. For details, see the cfexchangeconnection tag open action. Note: You can specify this tag’s attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

Attributes

AttributeDescriptionRequiredDefault
actionN/A
attachmentPathgetAttachments
connectionall
eventcreate modify
generateUnique FilenamesgetAttachments
messagedelete respond
namegetAttachments
notifydelete respond
responseTyperespond
resultcreate
uiddelete getAttachments modify respond

Usage

The cfexchangecalendar tag manages calendar events on the Exchange server. Use the cfexchangecalendar to do the following actions:
Create an appointment or meeting event. You can create all-day events.
Delete one or more events.
Get one or more events that conform to an optional set of filter specifications, such as the subject, sender or recipient ID, time received, and so on.
Get the attachments for a specific event.
Modify an existing event.
Respond to an event.
To use this tag, you must have a connection to an Exchange server. If you are using multiple tags that interact with the Exchange server, such as if you are creating several contact records, use the cfexchangeconnection tag to create a persistent connection. Then specify the connection identifier in each cfexchangecalendar tag, or in any other ColdFusion Exchange tag, if you are also accessing tasks, contacts, or mail. Doing this eliminates the overhead of creating and closing the connection for each tag.
Alternatively, you can create a temporary connection that lasts only for the time that ColdFusion processes the single cfexchangecalendar tag. To do this, specify the connection attributes directly in the cfexchangecontact tag. For details on the connection attributes, see the cfexchangeconnection tag.
Note: To create an Exchange calendar appointment, create a calendar event and do not specify any required or optional attendees.

Example

The following example lets you create, and then modify a calendar event. When you first submit the form, ColdFusion creates the calendar event and redisplays the form with the data you entered. Accept the event before you modify the form and resubmit it. When you submit the form a second time, ColdFusion sends the modification information. For more information, see Working with meetings and appointments in the Developing ColdFusion Applications. This example resends all the event data (to limit the example length), but you could change the example so that it only sends modified data.
<!--- Create a structure to hold the event information. ---> 
<!--- A self-submitting form for the event information ---> 
<!--- This example omits recurrence to keep the code relatively simple ---> 
<cfparam name="form.eventID" default="0"> 
 
<!--- If the form was submitted, populate the event structure from it. ---> 
<cfif isDefined("Form.Submit")> 
        <cfscript> 
        sEvent.AllDayEvent="no"; 
        sEvent=StructNew(); 
        sEvent.Subject=Form.subject; 
        if (IsDefined("Form.allDay")) { 
            sEvent.AllDayEvent="yes"; 
            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; 
        sEvent.message=Form.Message; 
    </cfscript> 
     
    <!--- If this is the first time the form is being submitted  
            Create a new event. ---> 
    <cfif form.eventID EQ 0> 
    <!--- 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> 
    <cfelse>          
    <!--- The form is being resubmitted with new data, so update the event. --->     
        <cfexchangecalendar action="modify"  
            username ="#user1#" 
            password="#password1#" 
            server="#exchangeServerIP#" 
            event="#sEvent#" 
            uid="#Form.eventID#"> 
        <cfoutput>Event ID #Form.eventID# Updated.</cfoutput> 
 
    </cfif> 
</cfif> 
 
<cfform format="xml" preservedata="yes" style="width:500" height="600"> 
    <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>  
    <cfinput type="textarea" label="Message" name="message" style="width:435; 
        height:100"> 
    <cfinput type="hidden" name="eventID" value="#Form.EventID#"> 
    <cfinput type="Submit" name="submit" value="Submit"> 
</cfform>