SmsGetFolderCount

The SmsGetFolderCount retrieves the number of folders of the specified type contained within the specified folder or container.

SMS_STATUS SmsGetFolderCount(
  HANDLE hFolder,    // Handle to a folder or container.
  DWORD fType,       // Type of folder.
  DWORD *pctFolders  // Pointer to DWORD value that will receive the 
                     // count.
);
 

Parameters

hFolder
Specifies the handle to the folder or container whose first-level folders (that is, folders directly beneath the specified folder or container) you want to count.
fType
Specifies the type of folder you want to count. See Folder Types. To count the total of all types of first-level folders, specify F_ANY.
pctFolders
Receives the count of the folders specified by fType.

Return Values

The SmsGetFolderCount function returns a status code SMS_STATUS. If successful, the function returns a status of SMS_OK. Otherwise, it returns one of the following manifest constants:

SMS_INVALID_HANDLE
The specified folder handle is not a valid folder handle or container handle.
SMS_NO_MORE_DATA
The specified hFolder is a folder type that cannot contain subfolders and the value specifed for fType is F_ANY.
SMS_INVALID_FOLDER_TYPE
The folder type specified is not one of the subfolder types that may be contained in the specified folder or container.
SMS_MORE_DATA
If SmsPopulate is used in asynchronous mode, the function is still retrieving folders from the site database, that is, not all folders have been retrieved yet.
SMS_NOT_READY
If SmsPopulate is used in asynchronous mode, the function has not yet retrieved any folders from the site database.

Remarks

SmsGetFolderCount retrieves the number of folders directly within the specified folder or container—this function does not do a recursive count of all folders, that is, the subfolders of the folders are not counted. For example, your application can use SmsGetFolderCount on a site container to retrieve the number of site folders at the top level of the container; however, SmsGetFolderCount does not count any site folders or domain folders within the top-level site folders.