IMAPIFolder::EmptyFolder

4/8/2010

The EmptyFolder method 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.

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

Use the DeleteFolder method 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

Reference

IMAPIFolder

Other Resources

Windows Mobile Defined MAPI Properties
Messaging