IMAPIFolder::DeleteFolder
The DeleteFolder method removes a subfolder from the current folder.
Syntax
HRESULT DeleteFolder (
ULONG cbEntryID,
LPENTRYID lpEntryID,
ULONG ulUIParam,
LPMAPIPROGRESS lpProgress,
ULONG ulFlags
);
Parameters
cbEntryID
[in] Count of bytes in the entry identifier pointed to by lpEntryID.lpEntryID
[in] Reference to an ENTRYID structure that represents the entry identifier of the subfolder to delete; cannot be NULL.ulUIParam
[in] Ignored.lpProgress
[in] Ignored.ulFlags
[in] Bitmask of flags that controls the deletion of the subfolder. The following flags can be set:DEL_FOLDERS
All subfolders of the subfolder pointed to by lpEntryID should be deleted. The method will fail if the subfolder being deleted contains subfolders and this flag is not set.
DEL_MESSAGES
All messages in the subfolder pointed to by lpEntryID should be deleted. The method will fail if the subfolder being deleted contains messages and this flag is not set.
Return Values
This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:
- S_OK
Indicates success. - MAPI_E_HAS_FOLDERS
The subfolder being deleted contains subfolders, and the DEL_FOLDERS flag was not set. The subfolder was not deleted. - MAPI_E_HAS_MESSAGES
The subfolder being deleted contains messages, and the DEL_MESSAGES flag was not set. The subfolder was not deleted. However, if the DEL_FOLDERS flag was set, some empty subfolders (within the subfolder being deleted) may have been deleted.
Remarks
Folders to be deleted must be located in the folder designated as the special wastebasket folder, typically the Deleted Items folder in the interpersonal message (IPM) subtree. By default, DeleteFolder operates only on empty folders, but it can be used successfully on non-empty folders by setting two flags: DEL_FOLDERS and DEL_MESSAGES. Only empty folders or folders that set both the DEL_FOLDERS and DEL_MESSAGES flags on the DeleteFolder call can be deleted. DEL_FOLDERS enables all of the folder's subfolders to be removed; DEL_MESSAGES enables all of the folder's messages to be removed.
When DeleteFolder is called on a folder that is not in the wastebasket, the method moves the folder to the wastebasket. In this case, the ulFlags value is ignored.
When DeleteFolder is unable to complete, do not assume that no work was done. DeleteFolder might have been able to delete one or more of the messages and subfolders before encountering the error.
Requirements
Smartphone: Windows Mobile 2002 and later
OS Versions: Windows CE 3.0 and later
Header: mapidefs.h
Library: cemapi.lib
See Also
Last updated on Friday, April 22, 2005
© 2005 Microsoft Corporation. All rights reserved.
Send feedback on this topic to the authors.