?
Solved

Ldap lookup, from a server not in AD Domian

Posted on 2008-10-28
4
Medium Priority
?
1,663 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 400 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

770 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