Deleting a Folder Tree
Deleting a Folder Tree
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The following example deletes a folder tree from the Exchange store. See Managing Exchange Server for an explanation of the folder tree.
Visual Basic
'////////////////////////////////////////////////////////////////////////////////// '// Name: DeletePublicFolderTree '// Purpose: To delete a Public Folder Tree '// Input: strFolderName = contains the name of the folder tree to be deleted '// strAdminGroup = contains the name of the Admin Group the Folder Tree is in '// strOrganization = contains the name of the Exchange Organization '// strDomain = contains the domain components of the LDAP path, eg: "DC=example,DC=com" '// '////////////////////////////////////////////////////////////////////////////////// Public Sub DeletePublicFolderTree(ByVal strFolderName As String, _ ByVal strAdminGroup As String, _ ByVal strOrganization As String, _ ByVal strDomain As String) On Error Resume Next Dim iServer As New CDOEXM.ExchangeServer Dim iPFTree As New CDOEXM.FolderTree Dim strFolderURL As String Dim strFHName As String ' Build the URL to the PublicFolderTree strFolderURL = "LDAP://CN=" + strFolderName + _ ",CN=Folder Hierarchies" + _ ",CN=" + strAdminGroup + _ ",CN=Administrative Groups" + _ ",CN=" + strOrganization + _ ",CN=Microsoft Exchange,CN=Services,CN=Configuration," + strDomain ' Bind to the Public Folder Tree iPFTree.DataSource.Open strFolderURL ' Delete the Public Folder Tree iPFTree.DataSource.Delete ' Cleanup Set iServer = Nothing Set iPFTree = Nothing End Sub
The preceding example needs to build a proper URL for creating a folder tree. See Retrieving Folder Tree URLs for a description of GetFolderTreeURL().
Deleting a folder tree will fail if there are any public stores still associated with the folder tree object when a request is made.
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.