Hi,
I wrote a C++ program to get the DN of a user in ActiveDirectory. The program is fetching the object successfully and identifying the attribute "distinguishedname" correctly. But when I'm trying to print the value of "distinguishedname" it is printing <null>. I'm not sure whether this is a problem with my code or with the AD setup I'm using. I'm here posting the code. Please check that and tell if there is something wrong with the code.
I have attached the source code I'm using.
I think you need to reference the returned data differently. At least in the sample, the return value appears to be an array of items. Also, the DN is referenced as a ".DNString".
from MSDN:
Code:
// Get the data for this column
wprintf(L"%s\n",col.pszAttrName);
switch (col.dwADsType)
{
case ADSTYPE_DN_STRING:
for (x = 0; x< col.dwNumValues; x++)
{
wprintf(L" %s\r\n",col.pADsValues[x].DNString);
}
break;
case ADSTYPE_CASE_EXACT_STRING:
case ADSTYPE_CASE_IGNORE_STRING:
case ADSTYPE_PRINTABLE_STRING:
case ADSTYPE_NUMERIC_STRING:
case ADSTYPE_TYPEDNAME:
case ADSTYPE_FAXNUMBER:
case ADSTYPE_PATH:
case ADSTYPE_OBJECT_CLASS:
for (x = 0; x< col.dwNumValues; x++)
{
wprintf(L" %s\r\n",col.pADsValues[x].CaseIgnoreString);
}
break;
// rest of code here...........
}
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.