ADsOpenObject() has failed with LDAP error 0x8007200f (- 2147016689) The directory service is unavailable

Navaneeth R 21 Reputation points
2024-01-23T13:57:10.5+00:00

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
{
	. . .
}
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
11,683 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,526 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 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