IDirectorySearch::ExecuteSearch

Executes a search and passes the results to the caller.

HRESULT ExecuteSearch(
  LPWSTR pszSearchFilter,  //Search filter string in LDAP format
  LPWSTR pAttributeNames,  //Attributes to be obtained
  DWORD dwNumberAttributes,  //Size of pAttributeNames array
  PADS_SEARCH_HANDLE phSearchResult
                           //Search result handle
);
 

Parameters

[in] pszSearchFilter
Search filter string in LDAP format.
[in] pAttributeNames
Array of attribute names for which data is requested. If NULL, all attributes are requested and dwNumberAttributes must be -1.
[in] dwNumberAttributes
Size of the pAttributeNames array. If -1, all attributes are requested and pAttributeNames must be NULL.
[out] phSearchResult
Address of a method-allocated handle to the search result. The caller passes this handle to other methods of IDirectorySearch to examine the search result.If NULL, the search could not be executed.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK
The search was successfully completed.

Remarks

The caller is responsible for calling CloseSearchHandle to release the memory allocated for the search handle and search result.

See Also

Using Directory Service Queries