Active Directory Service Interfaces - Connecting to the Internet

ADSI allows you to communicate to other Internet directories such as Yahoo, BigFoot, WhoWhere, and many others. Most directories store a person's e-mail address, address, and name. With ADSI, you can easily search for your friend's name and get back her e-mail address on the Internet. ADSIWAB is a working sample which does exactly that. The ADSIWAB source code can be found in the \\samples\internet directory.

Requirements

- ADSI 2.5 or higher. For more information and downloads, please visit http://www.microsoft.com/adsi.

- A connection to the Internet. If you're connected to the corporate LAN, you may need to install the client proxy which allows you to communicate to the Internet. The port number is 389.

Step-by-Step Instructions

You can use either Visual Basic® Scripting Edition or Visual C++®. For VBScript, you must use the ADO object model. For VC++, you can either use ADO/OLE DB or IDirectorySearch. For more information, see Getting Started with ADSI. Find out the Internet Directory address you want to connect to. For example, ldap.yahoo.com.

Let's assume you want to search for 'Loff' on the yahoo.ldap.com server:

1. Connect as an anonymous user. Set userName, password as "". Do not use a secure authentication flag when connecting to the directory server.
2. Set the base DN as GC://your.internet.address.com:389.
3. Set the filter as:
   (|(|(|(cn=loff*)(mail=loff*))(sn=loff*))(givenName=loff*))
4. Set the attributes returned as:
   cn,mail,givenName,sn,st,c,homePhone.
5. Set the search scope as: subtree.
6. Execute the query. You should get the result as shown above.