Acquiring mail-id databases as well using LDAP

Hi All,

I am using a VB script to get a directory listing of the Domino NAB using LDAP. I do get all the ‘People’ in the NAB, but we also need to get complete mail-in database list using the script. Is there any other setting under LDAP on Domino or do I need to modify my script?

Is there someone who can help me? Here is the script I am using:

Set oArgs = WScript.Arguments

ArgNum = 0

sArg0 = oArgs(ArgNum)

iCount = 0

Set fs=CreateObject(“Scripting.FileSystemObject”) 'used in creating text file

Set userFile=fs.createTextFile (“AUTO.TXT”) 'used in creating text file

userFile.Write “/CLEAR: _approved_local_address” & VbCrLf

userFile.Write “/MODIFY: _approved_local_address” & VbCrLf

Set objConnection = CreateObject(“ADODB.Connection”) 'used in creating dbase to import ldap requests for exporting

objConnection.Open “Provider=ADsDSOObject;” 'used in creating dbase to import ldap requests for exporting

Set objCommand = CreateObject(“ADODB.Command”) 'used in creating dbase to import ldap requests for exporting

objCommand.ActiveConnection = objConnection 'used in creating dbase to import ldap requests for exporting

'Next line has LDAP query for LDAP server

objCommand.CommandText = “<LDAP://” +sArg0 +“:390>;(&(objectClass=organizationalperson));mail;subtree”

Set objRecordSet = objCommand.Execute 'performs ldap query with results stored in Recordset

On Error Resume Next 'Picked up an error or 2 during next step but seems to get all addresses

Dim AddressArray

While Not objRecordset.EOF

    AddressArray = objRecordset.Fields(0).Value

    smtpAddress = AddressArray(0)

    If Len( smtpAddress ) > 0 Then

        Wscript.echo "  " & smtpAddress

        userFile.Write "+" & TRIM(smtpAddress) & VbCrLf  'write address to file then send carriage return line feed



    if instr(TRIM(smtpAddress),"_") then

	    userFile.Write "+" & Replace(TRIM(smtpAddress), "_", "-") & VbCrLf  'write address to file then send carriage return line feed

    end if

        iCount = iCount + 1

    End If

    objRecordset.MoveNext

Wend

Subject: Acquiring mail-id databases as well using LDAP

I am using a VB script to get a directory listing of the Domino NAB using LDAP. I do get all the ‘People’ in the NAB, but we also need to get complete mail-in database list using the script. Is there any other setting under LDAP on Domino or do I need to modify my script?

Before I start writing a single line of LDAP client code, whether it be in C/C++, Java, a scripting language, etc. I always first use ldapsearch or some other command line LDAP tool to test out my operations. Refer to the ND6 Directory FAQ for resources http://www-10.lotus.com/ldd/nd6forum.nsf/0/5c4bf25f844b9ac785256e4c005998b7?OpenDocument

Your VB script (I’m not familiar with it) contains this query, which says “look at sarg0:390, using a filter of (&(objectclass=organizationalperson)), return only the mail attribute, and search the entire subtree”

'Next line has LDAP query for LDAP server

objCommand.CommandText = “<LDAP://” +sArg0 +“:390>;(&(objectClass=organizationalperson));mail;subtree”

To find what the objectclass for a mail-in db is, I simply look for a known mail-in like so

1 [C:] ldapsearch -h klin0 “cn=administration requests”

CN=Administration Requests

cn=Administration Requests

mail=adminreq@klintest0.notesdev.ibm.com

maildomain=klintest0

objectclass=dominoServerMailInDatabase

objectclass=top

Now that I know the objectclass is dominoServerMailInDatabase, to find all mail-ins is easy.

1 [C:] ldapsearch -h klin0 “objectclass=dominoservermailindatabase”

CN=Lotus Notes,O=Domino Fault Reports

mail=Lotus_Notes/Domino_Fault_Reports%klintest0@iris.com

objectclass=dominoServerMailInDatabase

objectclass=top

maildomain=klintest0

CN=Administration Requests

cn=Administration Requests

mail=adminreq@klintest0.notesdev.ibm.com

maildomain=klintest0

objectclass=dominoServerMailInDatabase

objectclass=top

BTW, you have only one “&” clause in you query, so you should simplify it. i.e.,

objCommand.CommandText = “<LDAP://” +sArg0 +“:390>;(objectClass=dominoServerMailInDatabase);mail;subtree”

Subject: RE: Acquiring mail-id databases as well using LDAP

Hey thanks Ken, I managed to get mail-in databases as well using ‘cn=’.