MailPutFolderEx

This function, an extension of MailPutFolder, adds, deletes, or renames a folder, and operates in a multiple hierarchy folder environment.

At a Glance

Header file: Msgstor2.h
Platforms: H/PC 3.0
Windows CE versions: 2.10 and later

Syntax

BOOL MailPutFolder (HANDLE hMail, FID fidParent, FID fidFolder,
LPWSTR szName);

Parameters

hMail
[in] Handle to the mail context. This handle is created by the MailOpen function.
fidParent
[in] Folder identifier of the parent mail folder. If no parent folder exists, set fidParent to MAIL_FOLDER_NONE. A folder with created with fidParent set to MAIL_FOLDER_NONE is considered the base folder in a folder hierarchy. This function ignores this parameter if szName is set to NULL.
fidFolder
[in] Folder identifier of the target mail folder. Because a system folder cannot be modified or deleted, fidFolder cannot be any of the following identifiers: MAIL_FOLDER_INBOX, MAIL_FOLDER_OUTBOX, or MAIL_FOLDER_SENT.
szName
[in] Null-terminated string that contains the name of the mail folder. If NULL, this function deletes the folder identified by fidFolder.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call the function MailError or MailErrorMsg.

Remarks

If the fidFolder parameter identifies a folder that already exists in the message store, this function renames the folder based on the name specified in szName. If the folder exists and szName is NULL, the folder is deleted. If the identifier in fidFolder is not found in the database, this function creates a folder based on the name specified by szName.

    To find an unused folder identifier for fidFolder

  1. Start an iterative call on the function MailGetFolderNameEx, with the fID parameter set to MAIL_FOLDER_FIRST or MAIL_FOLDER_FIRST_OTHER.
  2. Continue to call MailGetFolderNameEx until you receive a folder identifier with no accompanying name.

The default mail folder hierarchy for the H/PC 3.0 is known as ActiveSync. Because all folders within the ActiveSync hierarchy have folder identifiers between 0 and 255, ActiveSync is backward-compatible with earlier versions of Windows CE. All folders outside the ActiveSync hierarchy have folder identifiers of 256 or greater.

See Also

MailGetFolderId