GetObject example (ASP)

This code can be found in Chapter 28 of Active Directory, 3rd Edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the ASP code from this site.

<HTML>
<!--
' From the book "Active Directory, Third Edition" 
' ISBN: 0-596-10173-2
-->
<HTML>
<HEAD>
<TITLE>Use of IADsContainer::GetObject</TITLE>
</HEAD>
   
<BODY>
<%
  adsOUPath = "LDAP://ou=Sales,dc=mycorp,dc=com"
  strUsername = "mycorp\administrator"
  strPassword = "My-admin-password!"
   
  Set objNamespace = GetObject("LDAP:")
  Set objSalesOU = objNamespace.OpenDSObject(adsOUPath,strUsername,strPassword,0)
   
  Set objUser1 = objSalesOU.GetObject("User","cn=Simon Williams")
  Set objUser2 = objSalesOU.GetObject("User","cn=Markie Newell")
  Set objUser3 = objSalesOU.GetObject("User","cn=Jason Norton")
   
  Response.Write "Simon Williams' description is: " & objUser1.Description
  Response.Write "<BR>Markie Newell's description is: " & objUser2.Description
  Response.Write "<BR>Jason Norton's description is: " & objUser3.Description
%>
</BODY>
</HTML>

This code has been viewed 5161 times.

New from the creators of TechTasks.com: StatSheet.com