Page 1 of 1 1
Topic Options
#188765 - 2008-07-15 10:30 PM query multivalue attribute from active directory
Deas Offline
Fresh Scripter

Registered: 2008-07-15
Posts: 6
hello,

first i must say hello and that i´m quite new to kix.

we run a quite large windows 2003 active directory with our own schema extension because we need some fields for specific user settings. we have some normal attributes and some multivalue. i have now problems reading the multivalue from active directory.

i use the function "fnLDAPQuery()" from your udf library which is working perfectly for all normal attributes.

but when i want to query for one of our own then i get the following error message:

"Error in expression: this type of array not supported in expressions.!"

my query looks like this:

 Code:
DIM $aAttributes, $sADsPath, $strFilter, $aResults

$aAttributes = "special-attribute01"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$strFilter = "(&(objectClass=User)(sAMAccountName=" + @WUSERID + "))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter)

$aResults[0,0] ?


what must i do that i can read these attributes?

thank you very much for your help!

brgds Deas

Top
#188766 - 2008-07-15 10:34 PM Re: query multivalue attribute from active directory [Re: Deas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11627
Loc: CA
As long as there is not an error in reading and filling the value here is what I "think" may be the issue.


 Code:
For Each $value in $aResults
  'entry is: ' + $value ?
EndIf


If that does not help let us know.

Top
#188767 - 2008-07-15 10:44 PM Re: query multivalue attribute from active directory [Re: NTDOC]
Deas Offline
Fresh Scripter

Registered: 2008-07-15
Posts: 6
hello,

wow - that was a quick response! \:\)

unfortunately it is not working.

when i comment the output so that the $aResults = fnLDAPQuery(..) is the last line i get no error. so this should be ok.

when i check the vartypename before and after the query i get a empty before and a variant[] after the query. so i think that ther is something in it.

but with code i am not able to extract the value...

any other idea?

brgds Deas

Top
#188779 - 2008-07-16 10:30 AM Re: query multivalue attribute from active directory [Re: NTDOC]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Doc, don't think you can do that with a two dimensional array.
end last time I checked a For Each closes with a Next ;\)

 Originally Posted By: NTDOC
As long as there is not an error in reading and filling the value here is what I "think" may be the issue.


 Code:
For Each $value in $aResults
  'entry is: ' + $value ?
;EndIf
Next


If that does not help let us know.


Edited by Björn (2008-07-16 10:32 AM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#188792 - 2008-07-16 12:48 PM Re: query multivalue attribute from active directory [Re: Deas]
Deas Offline
Fresh Scripter

Registered: 2008-07-15
Posts: 6
hello,

sorry - doesn´t change the error message...

what possibilities do i have to query these values? if possible i´d like to do it from within kix and not call an external vbs.

thank´s a lot for your help!

brgds Deas

Top
#188800 - 2008-07-16 05:20 PM Re: query multivalue attribute from active directory [Re: Björn]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
i think you are not so far from the solution with $aResults but the value returned for the attribut is also an array.

You should try something like that
 Code:
 for $i = 0 to UBound( $aResult,1 )
  for each $value in $aResult[$i,0]
    ? $value
  next


I haven't test the code
_________________________
Christophe

Top
#188801 - 2008-07-16 06:42 PM Re: query multivalue attribute from active directory [Re: Deas]
Deas Offline
Fresh Scripter

Registered: 2008-07-15
Posts: 6
YES, YES, YES, YES - YOU ARE MY HERO!!!!!!!!!!!!!!!!! \:\)

it is working and gives me the output i want to see!!!!

brgds Deas

Top
#188802 - 2008-07-16 09:32 PM Re: query multivalue attribute from active directory [Re: ChristopheM]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11627
Loc: CA
Thanks Christophe (and Bjorn) I'm in vacation mode and didn't even notice the code mistake. Sorry
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 550 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.058 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org