// Creates a subfolder under pFolder, opens the folder if it already exists
LPMAPIFOLDER CMAPIEx::CreateSubFolder(LPCTSTR szSubFolder, LPMAPIFOLDER pFolder) {
    if (!pFolder) {
        pFolder = m_pFolder;
        if (!pFolder) return NULL;
    }

    LPMAPIFOLDER pSubFolder   = NULL;
    ULONG        ulFolderType = FOLDER_GENERIC;
    ULONG        ulFlags      = OPEN_IF_EXISTS | cm_nMAPICode;

    pFolder->CreateFolder(ulFolderType, (LPTSTR)szSubFolder, NULL, NULL, ulFlags, &pSubFolder);
    return pSubFolder;
}