LDAP ADsGetObject C++ -> search error with User ID

  • Thread starter Thread starter SLIMTEC-2019
  • Start date Start date
S

SLIMTEC-2019

Guest
Hello to all,

PLZ i need help to set up a program that interogates my AD directory to retrieve user information with "ADsGetObject" with the "User ID"
so when I use this one with "WinNT:" it works here is an example that works:

HRESULT hr = ADsGetObject (L "WinNT: // DmaineName.local / UserID", IID_IADsUser, (void **) & pUser);
WCHAR * UserFullName = NULL;
WCHAR * UserFisrtName = NULL;
WCHAR * UserLastName = NULL;

pUser-> get_FullName (& UserFullName); // Works
pUser-> get_FirstName (& UserFisrtName); // Not Works (normal with WinNT)
pUser-> get_LastName (& UserLastName); // Not Works (normal with WinNT)

-------------------------------------------------- ---------------------------------
with surname and first name in LDAP:

HRESULT hr = ADsGetObject ("LDAP: // CN = Full Name, DC = DomainName, DC = Local" ", IID_IADsUser, (void **) & pUser);
WCHAR * UserFullName = NULL;
WCHAR * UserFisrtName = NULL;
WCHAR * UserLastName = NULL;

pUser-> get_FullName (& UserFullName); // Works
pUser-> get_FirstName (& UserFisrtName); // Works
pUser-> get_LastName (& UserLastName); // Works

-------------------------------------------------- -------------------------------
here is the problem:

HRESULT hr = ADsGetObject (L "" LDAP: // CN = UserID, DC = DomainName, DC = Local "", IID_IADsUser, (void **) & pUser);

or :

HRESULT hr = ADsGetObject ("LDAP: // uid = UserID, DC = DomainName, DC = Local" ", IID_IADsUser, (void **) & pUser);

it's when I use the User ID with LDAP it sends me an error code "0x80072030L -> LDAP_NO_SUCH_OBJECT -> ERROR_DS_NO_SUCH_OBJECT"

Thanks at advance

Continue reading...
 
Back
Top