Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

The DeleteFoldermethod 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 ENTRYIDstructure 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 lpEntryIDshould 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 lpEntryIDshould be deleted. The method will fail if the subfolder being deleted contains messages and this flag is not set.

Return Value

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_FOLDERSflag was not set. The subfolder was not deleted.

MAPI_E_HAS_MESSAGES

The subfolder being deleted contains messages, and the DEL_MESSAGESflag was not set. The subfolder was not deleted. However, if the DEL_FOLDERSflag 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 Itemsfolder in the interpersonal message (IPM) subtree. By default, DeleteFolderoperates only on empty folders, but it can be used successfully on non-empty folders by setting two flags: DEL_FOLDERSand DEL_MESSAGES. Only empty folders or folders that set both the DEL_FOLDERSand DEL_MESSAGESflags on the DeleteFoldercall can be deleted. DEL_FOLDERSenables all of the folder's subfolders to be removed; DEL_MESSAGESenables all of the folder's messages to be removed.

When DeleteFolderis called on a folder that is not in the wastebasket, the method moves the folder to the wastebasket. In this case, the ulFlagsvalue is ignored.

When DeleteFolderis unable to complete, do not assume that no work was done. DeleteFoldermight have been able to delete one or more of the messages and subfolders before encountering the error.

Requirements

Header mapidefs.h
Library cemapi.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also

Reference

IMAPIFolder

Other Resources

Messaging