次の方法で共有


IMAPITable::GetRowCount

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Returns the total number of rows in the table.

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 Value

  • 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 QueryPosition to retrieve the whole table. If there are more than twenty rows in the table, consider making multiple calls to QueryPosition 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.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MAPIFunctions.cpp

CopyFolderContents

MFCMAPI uses the IMAPITable::GetRowCount method to determine how many rows are in the source table so memory can be allocated to perform the copy.

See Also

Reference

IMAPITable::GetStatus

IMAPITable::QueryPosition

IMAPITable::QueryRows

IMAPITable::WaitForCompletion

IMAPITable : IUnknown

Concepts

MFCMAPI as a Code Sample