Solved

Ldap lookup, from a server not in AD Domian

Posted on 2008-10-28
4
1,627 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
ID: 22827895
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
ID: 22829598
hi,

Following error :

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

Mark
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22834976
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
ID: 23237872
the network admin had closed the required ports,,,,, now ok
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FRM-40735:KEY-COMMIT trigger raised unhandled exception ORA-01422 7 56
Sending Attachment via CDO 3 59
Powershell script 13 74
SSRS troubles 4 20
This article describes some very basic things about SQL Server filegroups.
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

867 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

15 Experts available now in Live!

Get 1:1 Help Now