I am trying to retrieve an object attribute in Active Directory that appears to be a multi-valued string (See canonicalName). After performing a search:
var conn;
conn.Open = Provider=ADsDSOObject; ;
var command = <LDAP://CN=Partitions,CN=Configuration,DC=domain,DC=com>;(&(objectcategory=crossRef)(systemFlags=3));name,nETBIOSName,nCName,canonicalName;onelevel ;
var ado = new ActiveXObject( ADODB.Command );
ado.ActiveConnection = conn;
ado.CommandText = command;
var records = ado.Execute;
and while looping through the recordset:
while (!records.Eof){
...
records.MoveNext();
}
I then try and get the canonicalName:
var cn = records.Fields( canonicalName ).Value;
The problem is that JavaScript doesn t intrepret cn as a string or as an array... if you look at the AD schema for the canonicalName you can see it s configured with isSingleValue = false which is what I believe is causing the problem...
When stepping through the code with Visual Studio I can drill into the string value and the QuickWatch shows cn.value(0) as returning the string value. But when I type that out it doesn t work...
I have tried the usual ways to get the value without luck:
for (var i in cn) { alert(cn[i]); }
and
for (i = 0; i < cn.length; i++) { alert(cn[i]); }
Neither works...
How can I read the value of this object?