Solved

Ldap lookup, from a server not in AD Domian

Posted on 2008-10-28
4
1,615 Views
Last Modified: 2013-12-24
I am using Lotuscript to lookup names on Active Directory server from as Domino server, which isnt in the AD domain. With out much luck...

Works fine from a browser in the AD Domian... (i do no use the username / password lines when in the AD)

if i use the username \ password lines i get the following error :  error: ADODB.Connection: Read-only property value was not set.

if i remove the username \ password lines i get the following error :  error: Provider: Table does not exist.

i have used the LDP.exe on the server it is running on and it connect to the AD just fine ??


Dim session As New notessession

	Dim doc As notesdocument

	Dim strQuery As String

	

	Set doc = session.DocumentContext

	strQuery = Strright(doc.Query_String(0),"lookup=")

	

	'=========================================================================

	'EVERYTHING BETWEEN THE TWO LINES RETRIEVES THE INFORMATION

	'FROM ACTIVE DIRECTORY VIA ASDI

	'=========================================================================

	Dim objConnection As Variant

	Dim objCommand As Variant

	Dim objRecordSet As Variant

	

	Dim strName As String

	Dim x As Integer

	

                    Const SEARCH_DOMAIN =  "servername.domain.net"
 

	Set objConnection = CreateObject("ADODB.Connection")

	objConnection.Open "Provider=ADsDSOObject;"

	

	Set objCommand = CreateObject("ADODB.Command")

	Set objCommand.ActiveConnection = objConnection

	

	objConnection.Properties("User ID") = "activedirectory\mylogin"

	objConnection.Properties("Password") = "mypassword"

	

	objCommand.CommandText = "<LDAP://" & SEARCH_DOMAIN & ">;(&(objectCategory=person)(objectClass=user)(sn=" & strQuery & "*));distinguishedName,cn;subtree"

	

	Set objRecordSet = objCommand.Execute

	

	'=========================================================================

	

	Print "Content-type: text/xml" 

	Print |<?xml version="1.0" encoding="UTF-8" ?>|

	Print |<viewentries toplevelentries="23">|

	

	x = 0

	

	While Not objRecordset.EOF

		

		strName = (objRecordset.Fields("cn").Value)

		

		If Not strName = "" Then

			Print |<viewentry position="| & x & |" siblings="23">|

			Print |<entrydata columnnumber="0" name="$1">|

			Print |<text>| & strName & |</text>|

			Print |</entrydata>|

			Print |</viewentry>|

			x = x +1

		End If

		

		objRecordset.MoveNext

		

	Wend

	

	Print |</viewentries>|

Open in new window

0
Comment
Question by:stirnpanzer
  • 2
  • 2
4 Comments
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 100 total points
Comment Utility
Hi, what does connection details like this give you?

Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject  ("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objConnection.Properties("User ID") = "yourdomain\user"
objConnection.Properties("Password") = "password"
objConnection.Properties("Encrypt Password") = True
objConnection.Properties("ADSI Flag") = 3



Regards,

Rob.
0
 

Author Comment

by:stirnpanzer
Comment Utility
hi,

Following error :

ADODB.Connection: Read-only property value was not set

Mark
0
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
Which line does that error point to?

I'm not sure about LotusScript, but you may be able to use OpenDSObject to provide extra credentials:
http://msdn.microsoft.com/en-us/library/aa706065(VS.85).aspx

Regards,

Rob.
0
 

Accepted Solution

by:
stirnpanzer earned 0 total points
Comment Utility
the network admin had closed the required ports,,,,, now ok
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now