I'm not sure how to access LDAP to export more than one field of data from LDAP.
I need to get the user name, email address, user location.
This is the code I'm using
On Error Resume Next
Dim qQuery, objConnection, objCommand, objRecordSet, obj
Dim oRootDSE, strDomain
Dim File1
Dim RF
set fso = CreateObject("Scripting.fileSystemObject")
set File1 = fspenTextFile("J:\emailaddress.txt",2,True)
Set oRootDSE = GetObject("LDAP://rootDSE")
strDomain = oRootDSE.get("defaultNamingContext")
qQuery = "<LDAP://" & strDomain &">;" & _
"(objectCategory=person)" & _
";adspath;subtree"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
RF = objRecordSet.Fields("adspath")
File1.WriteLine RF
objrecordset.MoveNext
Wend
close.File1
msgbox "done"
objConnection.Close
Thanks for any help in advance.
Tony
I need to get the user name, email address, user location.
This is the code I'm using
On Error Resume Next
Dim qQuery, objConnection, objCommand, objRecordSet, obj
Dim oRootDSE, strDomain
Dim File1
Dim RF
set fso = CreateObject("Scripting.fileSystemObject")
set File1 = fspenTextFile("J:\emailaddress.txt",2,True)
Set oRootDSE = GetObject("LDAP://rootDSE")
strDomain = oRootDSE.get("defaultNamingContext")
qQuery = "<LDAP://" & strDomain &">;" & _
"(objectCategory=person)" & _
";adspath;subtree"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
RF = objRecordSet.Fields("adspath")
File1.WriteLine RF
objrecordset.MoveNext
Wend
close.File1
msgbox "done"
objConnection.Close
Thanks for any help in advance.
Tony