Microsoft KB Archive/328024

= How To Retrieve Attribute Values of Site Server 3.0 LDAP Users with VBScript =

Article ID: 328024

Article Last Modified on 7/2/2004

-

APPLIES TO


 * Microsoft Site Server 3.0 Standard Edition

-



This article was previously published under Q328024



SUMMARY
The Microsoft Visual Basic Scripting Edition (VBScript) code sample in this article retrieves attributes of Site Server 3.0 Lightweight Directory Access Protocol (LDAP) users.



MORE INFORMATION
The code sample assumes that users are in the ou=members container.

The RetrieveMemberAttribute function takes the user name and attribute name to be retrieved and returns the user's attribute values.

Note that you must replace everything that is enclosed in brackets ([]) with the appropriate values for your environment. <% Public Function RetrieveMemberAttribute (UserName, AttributeName) Dim LDAPtest Dim ADSObject Dim MembersContainer Dim User Dim Item

Set LDAPtest = GetObject(&quot;LDAP:&quot;) Set ADSObject =

LDAPtest.OpenDSObject(&quot;LDAP://[LDAPServerName]:[LDAPPortNumber]/o=[RootName]&quot;,&quot;cn=Administrator,ou=Members,o=[RootName]&quot;,

&quot;[AdministratorPassword]&quot;, 0)   Set MembersContainer = ADSObject.GetObject (&quot;organizationalUnit&quot;,&quot;ou=Members&quot;)    Set User = MembersContainer.GetObject (&quot;member&quot;, &quot;cn=&quot;&UserName)    Item = User.Get(AttributeName)

RetrieveMemberAttribute=Item

Set Item = Nothing Set User = Nothing Set MembersContainer = Nothing Set ADSObject = Nothing Set LDAPtest = Nothing

End Function

'How to call the function RetrieveMemberAttribute: Response.Write RetrieveMemberAttribute(&quot;TestUserName&quot;, &quot;TestAttributeName&quot;)

%>

 ' THIS CODE AND INFORMATION IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ' ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED ' TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A ' PARTICULAR PURPOSE. ' ' Copyright (C) 2002. Microsoft Corporation. All rights reserved. 

Additional query words: LDAP, User attributes, sample code

Keywords: kbhowto KB328024

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.