Share via

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 for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | Other

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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.