Help / WLanguage / WLanguage functions / Communication / Managing emails
  • For an Outlook server
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Deletes a folder from the Outlook messaging software or from an IMAP server.
WINDEVWEBDEV - Server code
// Start the session
SessionID = EmailStartOutlookSession("MyProfile")
// Delete a folder
EmailRemoveFolder(SessionID, "Personal folders\Inbox\Work")
// Delete a folder from the current folder
EmailRemoveFolder(SessionID, EmailCurrentFolder(SessionID) + "\Work")
// IMAP protocol
MySession is emailIMAPSession
// Delete a folder from the current folder
EmailRemoveFolder(MySession, EmailCurrentFolder(MySession) + "\Work")
// Delete a folder from the custom folder
EmailRemoveFolder(MySession, "Personal folders\Inbox\MyOwnWork")
<Result> = EmailRemoveFolder(<Session> , <Folder path>)
<Result>: Boolean
  • True if the deletion was performed,
  • False otherwise. If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo with the errMessage constant.
<Session>: Character string, integer, or emailOutlookSession or emailIMAPSession variable
Identifier of current email session. This identifier can be:
<Folder path>: Unicode string
Path of folder to delete.
WINDEVWEBDEV - Server code

For an Outlook server

The folder must be found in the "Personal folders" branch.
During the call to EmailRemoveFolder, the following operations are automatically performed:
  • the messages found in the folder to delete are moved into the bin ("Deleted elements" folder).
  • the sub-folders of the folder to delete as well as their content are moved into the bin ("Deleted elements" folder).
  • the folder to delete is permanently deleted.
If the folder to delete is already found in the bin, the folder and its content are permanently deleted.
Reminder: This function cannot be used to delete a folder from the Outlook Express messaging software.
Component: wd290com.dll
Minimum version required
  • Version 11
This page is also available for…
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help