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 EmptyFoldermethod deletes all messages and subfolders from a folder without deleting the folder itself.

Syntax

HRESULT EmptyFolder (
  ULONG 
ulUIParam,
  LPMAPIPROGRESS 
lpProgress,
  ULONG 
ulFlags
);

Parameters

ulUIParam

[in] Ignored.

lpProgress

[in] Ignored.

ulFlags

[in] Ignored.

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_NO_SUPPORT

The method was called on a Search Folder.

MAPI_W_PARTIAL_COMPLETION

The method was called on the root folder of the message store, and it is possible that not all messages or subfolders were deleted. When this warning is returned, the call should be handled as successful.

Remarks

When EmptyFolder is unable to complete, do not assume that no work was done. EmptyFolder might have been able to delete some of the folder's contents before encountering the error.

EmptyFolderis not supported for Search Folders. If you attemtp to use it on one, it returns MAPI_E_NO_SUPPORT.

Use the DeleteFoldermethod if you want to ensure that subfolders that contain messages do not get deleted.

Requirements

Header mapidefs.h
Library cemapi.lib
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also