Platform SDK: Exchange Server |
This procedure can be used for creating a folder in the public, private, or personal information stores. You cannot create subfolders in the Favorites container of the public information store.
To create a folder
The following sample code illustrates this procedure:
// Open the parent (or root) folder... hr = lpMsgStore->OpenEntry( cbEID, // use 0L for root folder lpEID, // use NULL for root folder NULL, // use NULL for interface ID MAPI_MODIFY | MAPI_DEFERRED_ERRORS, // use MAPI_MODIFY if you plan to make changes &ulObjType, (LPUNKNOWN*)&lpParentFolder); // Create folder with MAPI call... hr = lpParentFolder->CreateFolder( FOLDER_GENERIC, TEXT("Folder Name"), TEXT("Folder Comment"), NULL, // Interface ID, must be NULL for client apps fMapiUnicode, &lpNewFolder); // At this point you may set the folder's PR_STATUS property. // It is purely optional, and may be any value you find meaningful. static SPropValue PropStatus = { PR_STATUS, 0L, {0L}}; SPropProblemArray lpProblems = NULL; hr = lpNewFolder->SetProps( 1, &PropStatus, &lpProblems);