The CreateFolder method creates a new subfolder in the current folder.
HRESULT CreateFolder ( ULONG ulFolderType, LPTSTR lpszFolderName, LPTSTR lpszFolderComment, LPCIID lpInterface, ULONG ulFlags, LPMAPIFOLDER FAR * lppFolder );
[in] Reference to a string containing the name for the new folder; cannot be NULL.
[in] Bitmask of flags that controls how the folder is created. The following flags can be set:
This flag is required. The passed-in strings are in Unicode format.
Allows the method to succeed — even if the folder named in the lpszFolderName parameter already exists — by opening the existing folder with that name. Message store providers that allow sibling folders to have the same name might fail to open an existing folder if more than one exists with the supplied name.
[out] Reference to the newly created folder object, implemented on IMAPIFolder.
CreateFolder creates a subfolder in the current folder and assigns an entry identifier to the new folder. When CreateFolder returns, the entry identifier is available for the new folder.
Some message store providers always point lppFolder to the folder's standard interface. MAPI requires the name of the new folder to be unique with respect to the names of its sibling folders. Be able to handle the MAPI_E_COLLISION error value, which is returned if this rule is not followed.