Page 1 of 2 12>
Topic Options
#130432 - 2004-12-01 03:38 PM HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Hi,

I've made a script where I want to get info from a LDAP server (NOT AD!). I have no proplems on getting normal LDAP objects as CN, SN, NAME etc. But When I want to get objects we have added to the LDAP I get an error:
COM exception error "get" (Active Directory - The Active Directory datatype cannot be converted to/from a native DS datatype) [-2147352567/80020009]

Hope someone can help me

Top
#130433 - 2004-12-01 03:49 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Btw. I'm using kix 4.22

The code is like this:

BREAK On
$FileName="C:\TEMP\RanaUserInfo.txt"
;$FileName="C:\TEMP\ADUserInfo.txt"
;$LDAP="LDAP://ou=users,ou=kpdk,dc=q8int,dc=com"
$LDAP="cn=HK,cn=Q8"
$predom="LDAP://rana/"
$domain="cn=HK,cn=Q8"


GetAllADUserInfoToFile($domain)



FUNCTION GetAllADUserInfoToFile($dom)
DIM $type
IF EXIST($Filename) = 1
DEL($Filename)
ENDIF
$ou = GETOBJECT($predom+$dom)
FOR EACH $Item IN $ou
$domain=$item.name+","+$dom
$ClassDom=GETOBJECT($predom+$domain)
$kurt=$ClassDom.objectclass
$type=0
FOR EACH $i IN $kurt
SELECT
CASE $i="applicationprocess"
$type=1
CASE $i="q8ansathk"
$type=2
ENDSELECT
NEXT
IF $type = 1
CALL GetAllADUserInfoToFile($domain)
ENDIF
IF $type = 2
IF OPEN(1,"$FileName", 5)= 0
$InitialObj=GETOBJECT($predom+$domain)
$init=$InitialObj.get("initialer")
$out = WRITELINE(1, $init+@serror+@crlf)
$x = CLOSE(1)
ENDIF
ENDIF
NEXT

ENDFUNCTION



Top
#130434 - 2004-12-01 03:51 PM Re: HowTo get LDAP object
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Well..

This will never work.

;$LDAP="LDAP://ou=users,ou=kpdk,dc=q8int,dc=com"

Is rana a DC? If so, you need entries for your dc too.

Like - dc=rana,dc=q8int,dc=com on the end of your LDAP String.


You need to uncomment this line.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#130435 - 2004-12-01 03:56 PM Re: HowTo get LDAP object
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not true.
_________________________
!

download KiXnet

Top
#130436 - 2004-12-01 03:59 PM Re: HowTo get LDAP object
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jooel,

You are right, you can just specify a DC as part of the LDAP://DC..

Maybe spark up a copy of ADSVW.EXE to see what canonical objects, etc. are.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#130437 - 2004-12-01 04:07 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
I know it wouldn't work, that's why I have comment it out :-) It was just for testing.

The LDAP server is NOT a DC. I'm not communicating whit an AD. It's our own LDAP server

Top
#130438 - 2004-12-01 04:09 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Hi,

It's not a Microsoft server I'm trying to communicate with. It's our own LDAP server (running on Solaris)

Top
#130439 - 2004-12-01 04:12 PM Re: HowTo get LDAP object
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, going back looking the error, it says it has problem with datatypes and their conversion...
_________________________
!

download KiXnet

Top
#130440 - 2004-12-01 04:14 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
What does that mean?? The native LDAP object (like CN, SN, NAME etc) does work. It's only when I try to get our own objects I get this error
Top
#130441 - 2004-12-01 04:15 PM Re: HowTo get LDAP object
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Perhaps you'd be better off with something like an ODBC LDAP connector.

The implication of the error message is that only native MS LDAP objects are supported via the LDAP: provider.

Top
#130442 - 2004-12-01 04:16 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
How do I use ODBC LDAP?
Top
#130443 - 2004-12-01 04:26 PM Re: HowTo get LDAP object
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Hmm. To be honest I'm not sure

I assumed that someone would have already provided this functionality, but a quick search has not shown up anything useful.

What is your LDAP server based on? Commonly they have a SQL back-end where the data is actually stored so you can interrogate this directly rather than using LDAP.

Top
#130444 - 2004-12-01 04:30 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
The person who know what SQL we are running has left, so I can't answer that question

Thanks for you answer

Top
#130445 - 2004-12-01 04:41 PM Re: HowTo get LDAP object
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Ok, this is a link to a posting which describes how to access an OpenLDAP service using VB. This should get you started:
http://www.dragoninc.on.ca/mail-archives/openldap-software/2002-04/0484.html

Top
#130446 - 2004-12-01 04:46 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Uuuh I'm not a VB man

Maybe I can find someone who is

Thanks for your help

Top
#130447 - 2004-12-01 04:47 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Does anyone know what else to do?
Top
#130448 - 2004-12-01 04:53 PM Re: HowTo get LDAP object
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You should be able to convert it to KiXtart almost word for word.

The best solution however would still be to talk to the back-end database directly.

What else do you know about the LDAP server software?

Top
#130449 - 2004-12-01 04:55 PM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
OK. I'll have a go.

I don't know much about the LDAP server, only it's a LDAP server and it's running on a Sun server

Top
#130450 - 2004-12-01 05:08 PM Re: HowTo get LDAP object
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is a littoral translation of the sample code into KiXtart, however I don't have anything to test on here:

Code:
; Build the LDAP search condition...
$vSearch = "(sn=Leeds)"

; Instantiate the connection and log in to OpenLDAP
$oConn=CreateObject("ADODB.Connection")
$oConn.Provider = "ADsDSOObject"
$oConn.Open("ADs Provider", "cn=mail_verify,ou=accounts,dc=mckee,dc=com", "mypassword")

; Execute the search...
$oRS=$oConn.Execute("<LDAP://leconte/dc=com/dc=mckee>;" + $vSearch + ";cn,mail")
; Create an array of returned values
$vCount = 1
While Not $oRS.EOF
For Each $vValue in $oRS.Fields(0).value
"Got: "+$vValue ?
Next

$oRS.MoveNext
Loop
Exit 0


Top
#130451 - 2004-12-02 10:29 AM Re: HowTo get LDAP object
jan Offline
Getting the hang of it

Registered: 2004-07-07
Posts: 66
Hi,

Got the new search working fine with standard LDAP objects, but when I tried our own defined objects I get this error:
COM exception error "Execute" (Provider - Unspecified error) [-2147352567/80020009]

Jan

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.071 seconds in which 0.023 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