HOWTO: How to Programmatically Create Members in Site Server 3.0ID: Q192781
|
This article describes how to programmatically create members in Site Server 3.0 Membership Directory using Active Directory Service Interfaces (ADSI) 2.0 and VBScript.
When you create a new Member object, the following three properties must be set:
Dim oADsContainer
Dim oADsNewUser
Dim oGuidGen
Dim strGuid
Dim strLdapPath
'The path to the ou=Members container
strLdapPath = "LDAP://localhost:5292/o=Microsoft/ou=Members"
'Instantiate the GUID Generator that comes with Site Server
'and store the GUID for use later on.
Set oGuidGen = CreateObject("Membership.GuidGen.1")
strGuid = oGuidGen.GenerateGuid
'Bind to the container in which the Member will be created
Set oADsContainer = GetObject(strLdapPath)
'Create the new user object, note that the Create() method
returns
'an interface pointer
Set oADsNewUser = oADsContainer.Create("member", "cn=JohnDoe")
oADsNewUser.Put "givenName", "John"
oADsNewUser.Put "sn", "Doe"
oADsNewUser.Put "userPassword", "password"
oADsNewUser.Put "GUID", CStr(strGuid)
oADsNewUser.SetInfo
'Destroy the objects
Set oGuidGen = Nothing
Set oADsNewUser = Nothing
Set oADsContainer = Nothing
"Active Directory Service Interfaces Version 2.0" located in the Microsoft Developer Network Library / SDK Documentation / Platform SDK / Networking and Distributed Services
Additional query words: kbDSupport
Keywords : prodsitesrv3
Version : winnt:3.0
Platform : winnt
Issue type : kbhowto
Last Reviewed: July 15, 1999