IADsOpenDSObject::OpenDSObject

Binds to an ADSI object using the given credentials, retrieving an IDispatch pointer on the specified object.

HRESULT IADsOpenDSObject::OpenDSObject(
  BSTR bstrDNName,       //ADsPath of the object to bind to
  BSTR bstrUserName,     //User Name to be used
  BSTR bstrPassword,     //Password to be used
  long lnReserved,       //Binding options
  IDispatch ** ppADSIObj  //Interface on an ADSI object
);
 

Parameter

bstrDNName
[in] ADsPath of the ADSI object.
bstrUserName
[in] The user name to be used for securing permission from the namespace server.
bstrPassword
[in] The password to be used for securing permission from the namespace server.
lnReserved
[in] Flags that define the binding options. There are two flags defined:
FLAG Value
ADSI_USE_SECURE_AUTHENTICATION 0x00000001
ADSI_USE_ENCRYPTION 0x00000010

See Notes to Implementers below.

ppADSIObj
[out] Indirect pointer to an IDispatch interface on

Return Values

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

S_OK
The IDispatch interface has been successfully retrieved using these credentials.

Remarks

To use default credentials, set bstrUserName and bstrPassword to NULL.

Notes to Implementers

The behavior of OpenDSObject when lnFlags is set is provider-specific. Namespaces that require high security may ignore these flags and always require authentication. For provider-specific details, see Microsoft Platform SDK ADSI reference section.

QuickInfo

  Windows NT: Use version 4.0 Service Pack 2 and later.
  Windows CE: Unsupported.
  Header: Declared in iads.h.

See Also

ADSI Namespace Object, IADsOpenDSObject