ADsOpenObject

In Active Directory, bind to an object using username and password credentials.

HRESULT ADsOpenObject(
  LPWSTR lpszPathName,  //The ADsPath name of the object
  LPWSTR lpszUserName,  //User name to use for credentials
  LPWSTR lpszPassword,  //Password to use for credentials
  DWORD dwReserved,     //Provider-specific flags
  REFIID riid,          //IID of primary interface
  VOID FAR * FAR *ppObject  //Interface on that object
);
 

Parameters

lpszPathName
[in] The path name to use to bind to the object in the underlying directory using the lpszUserName and lpszPassword credentials.
lpszUserName
[in] The user name to supply to the directory service to use for credentials.
lpszPassword
[in] The password to supply to the directory service to use for credentials.
dwReserved
[in] Provider-specific flags. See IADsOpenDSObject.
riid
[in] Interface identifier for the primary interface on this object.
ppObject
[out] Indirect pointer to the riid Interface identifier.

Return Values

This method supports the standard return values E_FAIL and E_UNEXPECTED, as well as the following:

S_OK
Binding to the specified object has been successful.

Remarks

The ADsOpenObject helper function is called by the C/C++ client to bind to an Active Directory object using the username and password as credentials for the appropriate directory service. This function is the code equivalent of calling the IADsOpenDSObject::OpenDsObject method.

QuickInfo

  Windows NT: Use version 4.0 and later.
  Windows CE: Unsupported.

See Also

ADSI Namespace Object, IADsOpenDSObject