cfexchangecontact
Description
Creates, deletes, modifies, and gets Microsoft Exchange contact records, and gets contact record attachments.
Categories
Related
History
ColdFusion
8: Added this tag.
Syntax
create
<cfexchangecontact
required
action = "create"
contact = "#contact information structure#"
optional
connection = "connection ID"
result = "variable for contact UID">
delete
<cfexchangecontact
required
action = "delete"
uid = "contact UID,contact UID, ..."
optional
connection = "connection ID">
deleteAttachments
<cfexchangecontact
required
action = "deleteAttachments"
uid = "contact UID"
optional
connection = "connection ID">
get
<cfexchangecontact
required
action = "get"
name = "query identifier"
optional
connection = "connection ID">
getAttachments
<cfexchangecontact
required
action = "getAttachments"
name = "query identifier"
uid = "contact UID"
optional
attachmentPath = "directory path"
connection = "connection ID"
generateUniqueFilenames = "no|yes">
modify
<cfexchangecontact
required
action = "modify"
contact = "#contact information structure#"
uid = "contact UID"
optional
connection = "connection ID>"
Note: If
you omit the connection attribute, create a temporary
connection by specifying cfexchangeconnection tag
attributes in the cfexchangecontact 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
| Attribute | Description | Required | Default |
|---|---|---|---|
| action | N/A | ||
| Assistant | BusinessFax | Attachments | BusinessAddress |
| attachmentPath | getAttachments | ||
| BusinessPhoneNumber | Department | Categories | Company |
| connection | all | ||
| contact | create modify | ||
| Description | Email2 | DisplayAs | Email1 |
| Email3 | HomePhoneNumber | FirstName | HomeAddress |
| generateUniqueFilenames | getAttachments | ||
| JobTitle | Manager | LastName | MailingAddressType |
| MiddleName | Office | MobilePhoneNumber | NickName |
| name | get getAttachments | ||
| OtherAddress | Profession | OtherPhoneNumber | Pager |
| result | create | ||
| SpouseName | WebPage | ||
| uid | getAttachments delete modify |
Usage
The cfexchangecontact tag manages contact records on the Exchange server. Use the cfexchangecontact tag to perform the following actions:
Create a contact.
Delete one or more contacts.
Get one or more contact records that conform to an optional set of filter specifications, such as the last name, job title, or home phone number, and so on.
Get the attachments for a specific contact record.
Modify an existing contact.
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. You then specify the connection identifier in each cfexchangecontact, or 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 cfexchangecontact tag. To do this, you specify the connection attributes directly in the cfexchangecontact tag. For details on the connection attributes, see the cfexchangeconnection tag open action.
Create a contact.
Delete one or more contacts.
Get one or more contact records that conform to an optional set of filter specifications, such as the last name, job title, or home phone number, and so on.
Get the attachments for a specific contact record.
Modify an existing contact.
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. You then specify the connection identifier in each cfexchangecontact, or 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 cfexchangecontact tag. To do this, you specify the connection attributes directly in the cfexchangecontact tag. For details on the connection attributes, see the cfexchangeconnection tag open action.
Example
The
following example lets a user enter information in a form and creates
a contact on the Exchange server with the information:
<!--- Create a structure to hold the contact information. --->
<cfset sContact="#StructNew()#">
<!--- A self-submitting form for the contact information --->
<cfform format="flash" width="550" height="460">
<cfformitem type="html"><b>Name</b></cfformitem>
<cfformgroup type="horizontal" label="">
<cfinput type="text" label="First" name="firstName" width="200">
<cfinput type="text" label="Last" name="lastName" width="200">
</cfformgroup>
<cfformgroup type="VBox">
<cfformitem type="html"><b>Address</b></cfformitem>
<cfinput type="text" label="Company" name="Company" width="435">
<cfinput type="text" label="Street" name="street" width="435">
<cfinput type="text" label="City" name="city" width="200">
<cfselect name="state" label="State" width="100">
<option value="CA">CA</option>
<option value="MA">MA</option>
<option value="WA">WA</option>
</cfselect>
<cfinput type="text" label="Country" name="Country" width="200" Value="U.S.A.">
<cfformitem type="html"><b>Phone</b></cfformitem>
<cfinput type="text" validate="telephone" label="Business" name="businessPhone"
width="200">
<cfinput type="text" validate="telephone" label="Mobile" name="cellPhone"
width="200">
<cfinput type="text" validate="telephone" label="Fax" name="fax" width="200">
<cfformitem type="html"><b>Email</b></cfformitem>
<cfinput type="text" validate="email" name="email" width="200">
</cfformgroup>
<cfinput type="Submit" name="submit" value="Submit" >
</cfform>
<!--- If a form was submitted, populate the contact structure from it. --->
<cfif isDefined("Form.Submit")>
<cfscript>
sContact.FirstName=Form.firstName;
sContact.Company=Form.company;
sContact.LastName=Form.lastName;
sContact.BusinessAddress.Street=Form.street;
sContact.BusinessAddress.City=Form.city;
sContact.BusinessAddress.State=Form.state;
sContact.BusinessAddress.Country=Form.country;
sContact.BusinessPhoneNumber=Form.businessPhone;
sContact.MobilePhoneNumber=Form.cellPhone;
sContact.BusinessFax=Form.fax;
sContact.Email1=Form.email;
</cfscript>
<!--- Create the contact in Exchange --->
<cfexchangecontact action="create"
username ="#user1#"
password="#password1#"
server="#exchangeServerIP#"
contact="#sContact#"
result="theUID">
<!--- Display a confirmation that the contact was added. --->
<cfif isDefined("theUID")>
<cfoutput>Contact Added. UID is#theUID#</cfoutput>
</cfif>
</cfif>