You can connect to an Exchange server with ColdFusion using two different types of connections: persistent and transient.
Persistent connections will remain open until they are explicitly closed. These connections enable you to use a single connection for multiple tasks, and save processing overhead from having to reopen connections for each interaction with the Exchange server.
Transient connections will only exist for the duration of the tag used to interact with the Exchange server. Transient connections can be used when you need to have access to the Exchange server for only one task or tag, such as retrieving a list of tasks.
Whether you're using persistent or transient connections, there is certain information you will need to connect to Exchange:
By default, ColdFusion will connect to the mailbox used by
the user specified in the username attribute. If this user has been
delegated access to another user's account, this account may be specified in
the mailbox attribute.
The following example shows how you to use a persistent connection to retrieve a user's contacts:
<cfexchangeconnection action="open" connection="myExchangeConnection" server="#serverName#" username="#username#" password="#password#" /> <cfexchangecontact action="get" name="myContacts" connection="myExchangeConnection" /> <cfexchangeconnection action="close" connection="myExchangeConnection" />
This example shows how you would use a transient connection to retrieve a user's contacts:
<cfexchangecontact action="get" name="myContacts" server="#serverName#" username="#username#" password="#password#" />