Whatever message this page gives is out now! Go check it out!

Deleting Exchange items and attachments

Last update:
Jun 9, 2026
To delete an exchange item, use the ColdFusion Exchange tag with the action attribute of delete and specify the item UID. Deleting the exchange item deletes all attachments
To delete only the attachments to an exchange item, use the ColdFusion Exchange tag with the action attribute of deleteAttachments and specify the item UID,
This example deletes all meeting requests in the Inbox for meetings that have passed, but does not delete any requests in folders in the Inbox. To delete requests in the Inbox, use a separate cfexchangemail tag for each folder. For information on accessing and using multiple folders, see Getting and using folder names in Getting Exchange items and attachments.
action="open"

username ="#user#"

password="#password#"

server="#exchangeServerIP#"

connection="conn1">

<!--- Get all meeting notifications from the Inbox. --->

<cfexchangemail action="get" name="requests" connection="conn1">

<cfexchangefilter name="MessageType" value="Meeting">

</cfexchangemail>

<!--- Get the meeting request data and put it in an array. --->

<cfset i=1>

<cfset meetingData=ArrayNew(1)>

<cfloop query="requests">

<cfexchangemail action="getmeetinginfo" connection="conn1"

name="meeting" meetinguid="#MeetingUID#" mailUID="#UID#">

<cfset meetingData[i]=meeting>

<cfset i=i+1>

</cfloop>

<!--- Loop through the request data array and delete any outdated

meeting messages from the Inbox. --->

<cfloop index="i" from="1" to="#ArrayLen(meetingData)#" >

<cfif meetingData[i].StartTime LTE now()>

<cfexchangemail action="delete" connection="conn1"

UID="#meetingData[i].UID#">

</cfif>

</cfloop>

<cfexchangeconnection

action="close"

connection="conn1">
For another example that deletes all mail from a known spam address, see Using persistent connections in Managing connections to the Exchange server.

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page