IMAPITable::GetRowCount
The IMAPITable::GetRowCount
method returns the total number of rows in the table. 
Quick Info
See IMAPITable
: IUnknown.
HRESULT GetRowCount(
|     ULONG ulFlags,
   |  | 
|     ULONG FAR * lpulCount |  | 
|    ) |  | 
Parameters
ulFlags
Reserved;
must be zero.
lpulCount
[out] Pointer
to the number of rows in the table.
Return Values
S_OK
The row count
was successfully returned.
MAPI_E_BUSY
Another
operation is in progress that prevents the row count retrieval operation from
starting. Either the operation in progress should be allowed to complete or it
should be stopped.
MAPI_E_NO_SUPPORT
The table
cannot calculate the number of rows.
MAPI_W_APPROX_COUNT
The call
succeeded, but an approximate row count was returned because the exact row
count could not be determined possibly due to memory constraints. To test for
this warning, use the HR_FAILED macro. See Using Macros for Error
Handling.
Remarks
The IMAPITable::GetRowCount
method retrieves the total number of rows in a table. 
Notes to Implementers
If you cannot
determine the table s exact row count, return MAPI_W_APPROX_COUNT and an
approximate row count in the contents of the lpulCount parameter.
Notes to Callers
Use GetRowCount
to find out how many rows a table holds before making a call to the IMAPITable::QueryRows method to retrieve the data.
If there are less than twenty rows in the table, it is safe to call QueryRows
to retrieve the whole table. If there are more than twenty rows in the table,
consider making multiple calls to QueryRows and limit the number of rows
retrieved in each call.
Some tables
do not support GetRowCount and return MAPI_E_NO_SUPPORT. If GetRowCount
is not supported, an alternative might be to call IMAPITable::QueryPosition. With the results from QueryPosition,
you can determine the relationship between the current row and last row. 
When GetRowCount
returns MAPI_E_BUSY because it is temporarily unable to retrieve a row count,
call the IMAPITable::WaitForCompletion method. When WaitForCompletion returns,
retry the call to GetRowCount. Another way to detect whether an
asynchronous operation is in progress is to call the IMAPITable::GetStatus method and check the
contents of the lpulTableState parameter. 
See Also