Partager via


IContentList::BuildIndex Method

Use this method to build an index for a specific column in a ContentList object.

HRESULT IContentList::BuildIndex(
  VARIANT vCol
);
Sub BuildIndex(
  vCol As Variant
)

Parameters

  • vCol
    [C++]

    [in] A VARIANT that identifies the column for which the index will be built. The column is identified by either a number representing a column position, starting at zero (0), or a string containing a column name.

    [Visual Basic]

    A Variant that identifies the column for which the index will be built. The column is identified by either a number representing a column position, starting at zero (0), or a string containing a column name.

Return Value

[C++]

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic]

None.

Error Values

[C++]

This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic]

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

  • S_FALSE
    An index already exists on the column.

Remarks

An index can be built on any read-only, non-private column that is of type string, integer, or array of strings or integers. (CLCOL_READONLY and not CLCOL_PRIVATE). Also, only columns of type CLCOL_I2, CLCOL_I4, CLCOL_STRING, and CLCOL_VARIANTARRAY can be indexed. The non-private restriction means that the column will actually reside in the corresponding ContentListFactory object.

If a search is conducted on a column for which no index yet exists, the index is automatically created. This means that, although you are never required to call the BuildIndex method, you may want to incur the cost of creating the index at a known time for performance sake.

This method is functionally identical to the one of the same name in the ContentListFactory object.

Example

myDataContainer.BuildIndex 10

See Also

Other Resources

ContentList Object