Directory Services

IDirectorySearch::GetNextColumnName

The IDirectorySearch::GetNextColumnName method gets the name of the next column in the search result that contains data.

HRESULT GetNextColumnName( 
  ADS_SEARCH_HANDLE hSearchHandle,
  LPWSTR* ppszColumnName
);

Parameters

hSearchHandle
[in] Provides a handle to the search context.
ppszColumnName
[out] Provides the address of a pointer to a method-allocated string containing the requested column name. If NULL, no subsequent rows contain data.

Return Values

This method returns the standard return values, as well as the following:

For other return values, see ADSI Error Codes.

Return Code Description
S_OK The name of the next column containing data was successfully obtained.
E_ADS_BAD_PARAMETER The search handle is invalid.
S_ADS_NOMORE_COLUMNS The current column is the last column and remains unchanged.

Remarks

This method allocates sufficient memory for the column name, but the caller must call the FreeADsMem helper function to free this memory when it is no longer needed.

Example Code [C++]

LPWSTR pszColumn;
m_pSearch->GetFirstRow( hSearch );
printf("Column names are: ");
while( m_pSearch->GetNextColumnName( hSearch, &pszColumn ) != S_ADS_NOMORE_COLUMNS )
{
   printf("%S ", pszColumn );
   FreeADsMem( pszColumn );
}

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IDirectorySearch, FreeADsMem, ADSI Error Codes