cfexchangefolder

Description

Lets you perform various actions on the mail folder, such as get folder information, find folders, or create, copy, modify, move, delete, and empty the contents of a folder.

History

ColdFusion 10: Added this tag.

Category

Communications tags

Syntax

getExtendedInfo
<cfexchangefolder
action = "getExtendedInfo"
folderID = "Exchange folder UID"
connection = "connection_ID"
name = "query_name"/>
OR

getExtendedInfo
<cfexchangefolder
action = "getExtendedInfo"
folderPath = "Exchange_folder_Path"
connection = "connection_ID"
name = "query_name"
pathDelimitter = "delimiter_characters"/>
getlnfo
<cfexchangefolder
action = "getInfo"
connection = "connection_ID"
folderID = "Exchange folder UID"
name = "query_name"/>
OR
getlnfo
<cfexchangefolder
action = "getInfo"
folderPath = "Exchange_folder_Name"
connection = "connection_ID"
name = "query_name"
pathDelimitter = "delimiter_characters"/>
findSubFolders
<cfexchangefolder
action = "findSubFolders"
folderID = "Exchange folder UID"
connection = "connection_ID"
name = "query_name"/>
create
<cfexchangefolder
action = "create"
folder = "struct"
parentFolderID = "folder_UID"
connection = "connection_ID"
result = "variable for contact UID"/>
copy
<cfexchangefolder
action = "copy"
destinationFolderID = "Folder_UID"
sourceFolderID = "folder_UID">
connection = "connection_ID"
result = "variable for contact UID"/>
delete
<cfexchangefolder
action = "delete"
deleteType = "hardDelete|softDelete|moveToDeletedItems"
uid = "folder UID">
connection = "connection_ID"/>
move
<cfexchangefolder
action = "move"
destinationFolderID = "Folder_UID"
sourceFolderID = "folder_UID">
connection = "connection_ID"
result = "variable for contact UID"/>
modify
<cfexchangefolder
action = "modify"
uid = "folder UID"
folder = "strut"
connection = "connection_ID"/>
empty
<cfexchangefolder
action = "empty"
uid = "folder UID"
deleteType = "hardDelete|softDelete|moveToDeletedItems">
deleteSubFolder = "true|false"
connection = "connection_ID"/>

See also

cfexchangecalendarcfexchangeconnectioncfexchangefiltercfexchangemailcfexchangetaskInteracting with Microsoft Exchange Servers in the Developing ColdFusion Applications

Attributes

Attribute

Action

Req/Opt

Default

Description

action

N/A

Required

 

The action to take. Must be one of the following values:

  • getInfo
  • getExtendedInfo
  • findSubFolders
  • create
  • copy
  • delete
  • move
  • modify
  • empty

uid

getExtendedInfo / getInfo

Not required for getExtendedInfo and getInfo, if folder path is specified.

 

UID that is used to identify the folder in which the actions are performed.

name

getExtendedInfo / getInfo / findSubFolders

Required

 

The name of the ColdFusion query variable that contains the returned information about the folder.

folderID

getExtendedInfo / getInfo / findSubFolders / delete / modify / empty

Not required for getExtendedInfo and getInfo, if folder path is specified.

 

UID that is used to identify the folder in which the actions are performed.

folderPath

getExtendedInfo / getInfo

Not required if folderID is specified.

 

Full path to the folder where the action has to be performed.
If you do not specify the path delimiter, / is taken by default.

pathDelimiter

getExtendedInfo / getInfo

Optional

/

Lets you specify the delimiter that is used to separate the folders.

parentFolderId

create

Required

 

UID that is used to identify the folder in which you create subfolders.

connection

All actions

Required

 

The name of the connection to the Exchange server, as specified in the cfexchangeconnection tag. If you omit this attribute, create a temporary connection by specifying cfexchangeconnection tag connection openaction attributes in the cfexchangecontact tag.

result

create / copy / move

Required

 

A query variable that contains the result returned from the exchange server when one of the action is performed.

destinationFolderID

copy / move

Required

 

A case-sensitive Exchange UID value that uniquely identifies the destination folder.

sourceFolderID

copy / move

Required

 

The UID that is used to identify the folder from which you copy or move folders to the destination folder.

deleteType

delete / move

Optional

moveToDeletedItems

  • hardDelete: Removes a folder permanently from the Exchange server.
  • softDelete: Moves a folder to the dumpster in Exchange server, if dumpster is enabled.
  • moveToDeletedItems: Moves a folder to the deleted items folder.

deleteSubFolders

empty

Optional

False

If true, deletes the subfolder.

folder

create / modify

Required

 

A struct that contains the required information of the folder that has to be created or modified, such as display name and folder class.

Result struct values for cfexchangefolder action = "getExtendedInfo"

For the action getExtendedInfo, the result is a struct that contains the following fields:

Field

Description

ChildFolderCount

The number of child folders that the parent folder has.

displayName

The display name of the folder.

folderClass

The folder class.

FolderPath

Path to the exchange server folder.

ManagedFolder

Struct that contains the following properties:

  • canDelete: Boolean value that indicates if the user can delete objects in the folder.
  • canRenameOrMove: Boolean value that indicates if the user can rename or move objects in the folder.
  • mustDisplayComment: Boolean value that indicates if the client application must display the comment property to the user.
  • HasQouta: Boolean value that indicates if the folder has a quota.
  • IsManagedFoldersRoot: Boolean value that indicates if the folder is the root of the managed folder hierarchy.
  • ManagedFolderId: The ID of the managed folder.
  • comment: The comment that is associated with the folder.
  • StorageQuota: The storage quota of the folder.
  • FolderSize: The size of the folder.
  • HomePage: The home page associated with the folder.

mustDisplayComment

Boolean value that indicates if the client application must display the comment property to the user.

ParentFolderId

The ID of the folder's parent folder.

Permission

List of permissions for the folder. This is an array of permission structs with the following values:

  • canCreateItems: Boolean value that indicates if the user can create new items.
  • canCreateSubFolders: Boolean value that indicates if the user can create sub-folders.
  • deleteItems: Indicates if/how the user can delete existing items. The values are None (the user does not have the associated permission), Owned (the user has the associated permission on items that it owns), and All (the user has the associated permission on all items).
  • displayPermissionLevel: The permission level that Outlook displays for this folder permission. It can have the following values: None, Owner, PublishingEditor, Editor, PublishingAuthor, Freebusytimeandsubjectandlocation, FreebusytimeOnly, Author, NonEditingAuthor, Reveiwer, Contributor, and Custom.
  • EditItems: Indicates the items in a folder that the user has permission to edit. Values are none, owned, or all.
  • isFolderContact: Boolean value that indicates if the user is a contact for the folder.
  • isFolderOwner: Boolean value that indicates if the user owns the folder.
  • isFolderVisible: Boolean value that indicates if the folder is visible to the user.
  • PermissionLevel: Represents the combination of permissions that a user has on a folder. The values are same as that of displayPermissionLevel except Freebusytimeandsubjectandlocation and FreebusytimeOnly.
  • readItems: The read item access permission. The values are as follows: None (user has no read access on the items in the folder), TimeOnly (user can read the start and end date and time of appointments; applies only to Calendar folders, TimeAndSubjectAndLocation (user can read the start and end date and time, subject, and location of appointments; applies only to calendar folders, and FullDetails (user has access to full details of items).
  • UserIDDisplayName: Display name of the user.
  • UserIDprimarySMTPAddress: The primary SMTP address of the user.
  • userIDSID: SID of the user.
  • UserIdstandardUser: Indicates the standard user, if default (the default delegate user, used to define default delegate permissions and Anonymous (the anonymous delegate user, used to define delegate permissions for unauthenticated users).

TotalCount

Total number of items contained in the folder.

UnreadCount

Number of unread items in the folder.

Result struct values for cfexchangefolder action = "getInfo"

For the action getInfo, the result is a struct that contains the following fields:

Field

Description

ChildFolderCount

The number of child folders this folder has

displayName

The display name of the folder

folderClass

Folder class

folderPath

Path to the exchange server folder.

UID

ID of the folder

ParentFolderId

The Id of the current folder's parent folder

TotalCount

Total number of items contained in the folder

UnreadCount

The number of unread items in the folder

Filter parameters for cfexchangefolder action = "findSubFolders"

For the action findSubFolders, the result is a query that contains details of the subfolders. The values are same as that of cfexchangefolder action = "getInfo".

Example

The following code shows how you can perform the actions getExtendedInfo, findSubFolders, getInfo, copy, delete, modify, move, and create.

<cfexchangeconnection action="open" username="folder" password="Password" server="IP_Address"
serverversion="2010" connection="conn1">
<cfexchangefolder action="getExtendedInfo" connection="conn1" name="result" folderpath="Drafts">
<cfexchangefolder action="getExtendedInfo" connection="conn1" name="result3" folderpath="Inbox">
<!--- Checking if the folder is already present.. If it is present then delete it --->
<cfexchangefolder action="findsubfolders" connection="conn1" name="final" uid="#result3.uid#">
<cfexchangefilter name="displayname" value="folder1">
</cfexchangefolder>
<cfexchangefolder action="findsubfolders" connection="conn1" name="final1" uid="#result.uid#">
<cfexchangefilter name="displayname" value="folder1">
</cfexchangefolder>
<cfif (#final.displayname# EQ "folder1")>
<cfexchangefolder action="delete" connection="conn1" uid="#final.uid#" deletetype="harddelete">
<cfscript>
sleep(1000);
</cfscript>
<cfelseif (#final1.displayname# EQ "folder1")>
<cfexchangefolder action="delete" connection="conn1" uid="#final1.uid#" deletetype="harddelete">
<cfscript>
sleep(1000);
</cfscript>
</cfif>
<cfset newfolder = structnew()>
<cfset newfolder.displayname = "folder1">
<cfset newfolder.folderclass = "IPF.Note">
<cfexchangefolder action="create" connection="conn1" parentfolderid="#result.uid#"
folder="#newfolder#" result="result1">
</cfexchangefolder>
<!--- Source folder --->
<cfexchangefolder action="findsubfolders" connection="conn1" name="result2" uid="#result.uid#">
<cfexchangefilter name="displayname" value="folder1">
</cfexchangefolder>
<!---modifying the folder--->
<cfset modfolder = structnew()>
<cfset modfolder.displayname = "exchange">
<cfset modfolder.folderclass = "IPF.Calendar">
<cfexchangefolder action="modify" connection="conn1" uid="#result2.uid#" folder="#modfolder#">
</cfexchangefolder>
<cfexchangefolder action="findsubfolders" connection="conn1" name="result5" uid="#result.uid#">
<cfexchangefilter name="displayname" value="exchange">
</cfexchangefolder>
<cfdump var="#result5#">
<!--- Destination folder --->
<cfexchangefolder action="getInfo" connection="conn1" name="result3" folderpath="Inbox">
<cfexchangefolder action="copy" connection="conn1" result="copiedfolderid"
sourcefolderid="#result2.uid#" destinationfolderid="#result3.uid#">
<cfexchangefolder action="findsubfolders" connection="conn1" name="result2" uid="#result.uid#">
<cfexchangefilter name="displayname" value="exchange">
</cfexchangefolder>
<cfdump var="#result2#">
<cfexchangefolder action="findsubfolders" connection="conn1" name="result4" uid="#result3.uid#">
<cfexchangefilter name="displayname" value="exchange">
</cfexchangefolder>
<cfdump var="#result4#">
<!---Deleting the folder from source --->
<cfexchangefolder action="delete" connection="conn1" uid="#result2.uid#" deletetype="harddelete">
<cfexchangefolder action="move" connection="conn1" result="movedfolderid"
sourcefolderid="#result4.uid#" destinationfolderid="#result.uid#">
<cfexchangefolder action="findsubfolders" connection="conn1" name="result6" uid="#result.uid#">
<cfexchangefilter name="displayname" value="exchange">
</cfexchangefolder>
<cfdump var="#result6#">
<cfexchangefolder action="delete" connection="conn1" uid="#result6.uid#" deletetype="harddelete">

 

Get help faster and easier

New user?