ADsOpenObject() has failed with LDAP error 0x8007200f (- 2147016689) The directory service is unavailable
Navaneeth R
21
Reputation points
Greetings! When I call ADsOpenObject(LdapPath, userName, password, dwReserved, IID_IADs, (void**)&pObject); it is failed with "0x8007200f", whereas the LdapPath is like LDAP://<Server Address>/DC=AD_domain,DC=com. Please refer to the code snippet below, thanks!
IADs *pObject = NULL;
HRESULT hr = CoInitialize(NULL);
if ( FAILED(hr) )
{
return hr;
}
DWORD dwReserved = ADS_SECURE_AUTHENTICATION; //ADS_SECURE_AUTHENTICATION = 1
hr = ADsOpenObject(LdapPath, //LdapPath=LDAP://<Server Address>/DC=AD_domain,DC=com
userName,
password,
dwReserved,
IID_IADs,
(void**)&pObject); //Here it is failed with 0x8007200f.
if (FAILED(hr))
{
if(LdapPath!=NULL)
delete[] LdapPath;
CoUninitialize();
return hr;
}
else
{
. . .
}
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more