Solved

Ldap lookup, from a server not in AD Domian

Posted on 2008-10-28
4
1,658 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Upcoming Webinar: Securing your MySQL/MariaDB data

Join Percona’s Chief Evangelist, Colin Charles as he presents Securing your MySQL®/MariaDB® data on Tuesday, July 11, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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…

696 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