IContentListSchema::GetSchema Method [C++]

[C++] Use this method to read the entire schema from a ContentListSchema object.

[C++] This is one of the two ContentListSchema methods that, in the interest of high performance, do not support a scriptable interface. The other method is SetSchema. They are only intended for use in C++.

[Visual Basic] In the interest of high performance, this method is not intended for use from Microsoft Visual Basic or Microsoft Visual Basic Scripting Edition (VBScript).

[C++]

Definition

HRESULT IContentListSchema::GetSchema(long*pnCols,
 CLCOL_DESCRIPTOR**prgColDesc);

Parameters

  • pnCols
    [out] A pointer to a long used to return the number of columns in the schema being returned. This value will be important in processing the array of column descriptors returned in the prgColDesc parameter.
  • prgColDesc
    [out,size_is(,*pnCols)] The address of a pointer used to return the address of an array of CLCOL_DESCRIPTOR structures. These structures represent the entire schema, where each element in the array contains information regarding the column in that same position in the schema. For more information about the column descriptor structure, see ContentListSchema Object.

Return Values

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

Error Values

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.

Remarks

Care must be taken in how the memory returned by calls to the GetSchema method gets released. The following code sample illustrates the proper technique:

// Declare variables for the GetSchema call.
long              cCols
CLCOL_DESCRIPTOR *pColDesc;

// Get the schema.
pContentListSchema->GetSchema(&cCols, &pColDesc);

// Use the returned schema as needed.

// When finished with the schema array,
// start by freeing the column name string memory.
for ( int i=0 ; I < cCols ; i++ ) {
    if ( NULL != pColDesc[i].pwszName ) {
        ::CoTaskMemFree(pColDesc[i].pwszName);
    }
}

// Then free the structure array memory.
::CoTaskMemFree(pColDesc);

See Also

[C++]ContentListSchema Object

[Visual Basic]ContentListSchema Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.