cfexchangeconnection
Description
Opens or closes a persistent connection to a Microsoft Exchange server, or gets information about mailbox subfolders. You must have a persistent or temporary connection to use the cfexchangecalendar, cfexchangecontact, cfexchangemail, and cfexchangetask tags.
Categories
Related
History
ColdFusion
8: Added this tag.
Syntax
open
<cfexchangeconnection
required
action = "open"
connection = "connection ID">
server = "Exchange server ID"
username = "Exchange user ID">
optional
ExchangeApplicationName = "Application name"
ExchangeServerLanguage = "Language name"
formBasedAuthentication = "no|yes">
formBasedAuthenticationURL = "URL">
mailboxName = "Exchange mailbox">
password = "user password"
port = "IP port"
protocol = "http|https"
proxyHost = "proxy host URL"
proxyPort = "proxy IP port"
getSubfolders
<cfexchangeconnection
required
action = "getSubfolders"
connection = "connection ID">
name = "query name"
optional
folder = "Exchange folder path">
recurse = "no|yes">
OR
<cfexchangeconnection
required
action = "getSubfolders"
name = "query name"
server = "Exchange server ID"
username = "Exchange user ID">
optional
ExchangeApplicationName = "Application name"
ExchangeServerLanguage = "Language name"
folder = "Exchange folder path">
formBasedAuthentication = "no|yes">
formBasedAuthenticationURL = "URL">
mailboxName = "Exchange mailbox">
password = "user password"
port = "IP port"
protocol = "http|https"
proxyHost = "proxy host URL"
proxyPort = "proxy IP port"
recurse = "no|yes">
close
<cfexchangeconnection
required
action = "close"
connection = "connection ID">
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
| Attribute | Description | Required | Default |
|---|---|---|---|
| action | all | ||
| connection | all | ||
| ExchangeApplicationName | open getSubfolders | ||
| ExchangeServerLanguage | open getSubfolders | ||
| folder | getSubfolders | ||
| formBasedAuthentication | open getSubfolders | ||
| formBasedAuthenticationURL | open getSubfolders | ||
| mailboxName | open getSubfolders | ||
| name | getSubfolders | ||
| password | open getSubfolders | ||
| port | open getSubfolders | ||
| protocol | open getSubfolders | ||
| proxyHost | open getSubfolders | ||
| proxyPort | open getSubfolders | ||
| recurse | getSubfolders | ||
| server | open getSubfolders | ||
| username | open getSubfolders |
Usage
The cfexchangeconnection tag can open or close a persistent connection with an Exchange server. If you use the cfexchangeconnection to open a connection before you use any cfexchangecalendar, cfexchangecontact, cfexchangemail, or cfexchangetask tags, you can use multiple tags to interact with the Exchange server without incurring the overhead of creating a connection for each tag.
Note: To establish any connection, the Exchange server must grant you Outlook Web Access. For information on how to enable this access, see Enabling access to the Exchange server in the Developing ColdFusion Applications. Also, you cannot establish a connection to an Exchange server if you require a special authentication step, such as requiring a VPN PIN or performing biometric authentication, on a server that is outside your firewall, and the authentication server then routes the messages to your Exchange server inside the firewall.
Use the cfexchangeconnection tag to close a persistent connection when you are finished accessing the Exchange server. If you do not close the connection, it remains open and does not time out.
The cfexchangecalendar, cfexchangecontact, cfexchangemail, and cfexchangetask tags also let you specify the open action connection attributes (but not the connection attribute) to create a temporary connection that lasts for the duration of the single tag’s activities, without requiring you to use the cfexchangeconnection tag to create the connection. In this case, ColdFusion automatically closes the connection when the tag completes processing.
The getSubfolders action can get information about the immediate subfolders of a specified folder (or of the top level of the mailbox), or information about all levels of subfolders. You must have a persistent connection to get the subfolders.
The query returned by the getSubfolders action has the following columns:
Column
Contents
FOLDERNAME
The name of the subfolder, for example, ColdFusion.
FOLDERPATH
The forward slash (/) delimited path to the folder from the mailbox root, including the folder name, for example, Inbox/Marketing/ColdFusion.
FOLDERSIZE
Size of the folder in bytes.
Note: The ColdFusion exchange tags, including cfexchangeconnection use WebDAV to connect to the exchange server. HTTP access must be enabled on the exchange server to use the tags.
Note: To establish any connection, the Exchange server must grant you Outlook Web Access. For information on how to enable this access, see Enabling access to the Exchange server in the Developing ColdFusion Applications. Also, you cannot establish a connection to an Exchange server if you require a special authentication step, such as requiring a VPN PIN or performing biometric authentication, on a server that is outside your firewall, and the authentication server then routes the messages to your Exchange server inside the firewall.
Use the cfexchangeconnection tag to close a persistent connection when you are finished accessing the Exchange server. If you do not close the connection, it remains open and does not time out.
The cfexchangecalendar, cfexchangecontact, cfexchangemail, and cfexchangetask tags also let you specify the open action connection attributes (but not the connection attribute) to create a temporary connection that lasts for the duration of the single tag’s activities, without requiring you to use the cfexchangeconnection tag to create the connection. In this case, ColdFusion automatically closes the connection when the tag completes processing.
The getSubfolders action can get information about the immediate subfolders of a specified folder (or of the top level of the mailbox), or information about all levels of subfolders. You must have a persistent connection to get the subfolders.
The query returned by the getSubfolders action has the following columns:
Column
Contents
FOLDERNAME
The name of the subfolder, for example, ColdFusion.
FOLDERPATH
The forward slash (/) delimited path to the folder from the mailbox root, including the folder name, for example, Inbox/Marketing/ColdFusion.
FOLDERSIZE
Size of the folder in bytes.
Note: The ColdFusion exchange tags, including cfexchangeconnection use WebDAV to connect to the exchange server. HTTP access must be enabled on the exchange server to use the tags.
Example
The
following example opens a connection, gets all mail sent from spamsource.com,
and deletes the messages from the Exchange server:
<cfexchangeConnection
action="open"
username="#user1#"
password="#password1#"
server="#exchangeServerIP#"
connection="testconn1">
<cfexchangemail action="get" name="spamMail" connection="testconn1">
<cfexchangefilter name="fromID" value="spamsource.com">
</cfexchangemail>
<cfloop query="spamMail">
<cfexchangeMail action="delete" connection="testconn1" uid="#spamMail.uid#">
</cfloop>
<cfexchangeConnection
action="close"
connection="testconn1">