Accessibility

ColdFusion Article

 

Using ColdFusion 8 with Microsoft Exchange Server


Table of Contents

Retrieving items from Exchange Server

For the scheduling application I discussed above, I first create the list of available times.  As in the original application, the manager has the responsibility of maintaining the available times.  However, with the revised code, the managers can use Outlook, a tool they are comfortable with and already use.  For the examples shown here, let's assume each manager specifies his or her own available time by setting an appointment in Outlook and giving it a subject of "Evaluation-Open." Using ColdFusion 8, I can look at the manager's calendar and only display these items. When an employee schedules his or her evaluation, you change the subject text to "Evaluation – {employee Name}."  For the purposes of this article, I have set the code samples to work only with appointments that fall between December 1, 2007 and December 15, 2007.

To retrieve calendar information from Exchange, use the cfexchangecalendar tag. In this particular case, you also need to use the cfexchangefilter tag because you only need retrieve certain appointments that fall between December 1, 2007 and December 15, 2007.  Here is what the cfexchangecalendar code block would appear:

<cfexchangeconnection action="open" connection="myExchangeConnection"
     server="#serverName#"
     username="#username#"
     password="#password#"
     mailboxname="#mailbox#">
     <cfexchangecalendar action="get" connection="myExchangeConnection" name="managerCalendar">
          <cfexchangefilter name="startTime" from="12/1/2007" to="12/15/2007"/>
          <cfexchangefilter name="subject" value="Evaluation-Open"/>
     </cfexchangecalendar>
<cfexchangeconnection action="close"connection="myExchangeConnection">

Anytime you retrieve information from an Exchange server, regardless of which tag set is being used, a ColdFusion query object is returned. The different item types (contact, calendar, task and mail) return slightly different result sets. One column that is returned with every query object is UID. The UID of an item uniquely identifies the item within Exchange.

If you needed additional filters, you could simply add more cfexchangefilter tags as needed.  It is important to note that when filtering, if multiple filter names are used, ColdFusion will retrieve items that match all filters.  If you use more than one filter with the same name, ColdFusion will retrieve items that match only the last listed filter. The name of the filter must equal the name of one of the columns in the query object.