本文介绍了LDAP ADsGetObject C ++ - & gt;用户ID搜索错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

PLZ我需要帮助来设置一个程序来拦截我的使用"ADsGetObject"检索用户信息的AD目录。使用"用户ID"

所以当我使用"WinNT:"时它在这里工作是一个有用的例子:
$


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); //作品

    pUser-> get_FirstName(& UserFisrtName); //无效(使用WinNT正常)

  pUser-> get_LastName(& UserLastName); // Not Works(WinNT正常)



-------- ------------------------------------------ -------- -------------------------

在LDAP中使用姓氏和名字:



HRESULT hr = ADsGetObject(" LDAP:// CN =全名,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



-------------- ------------------------------------ -------------- -----------------

问题在于:



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



或:



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



当我在LDAP中使用用户ID时,它会向我发送错误代码"0x80072030L - > LDAP_NO_SUCH_OBJECT - > ERROR_DS_NO_SUCH_OBJECT" 

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" 

提前致谢




推荐答案


这篇关于LDAP ADsGetObject C ++ - & gt;用户ID搜索错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:47