home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / ADSDK.ZIP / Samples / SiteServer / CreateMember / Member.bas next >
Encoding:
BASIC Source File  |  1999-03-10  |  961 b   |  34 lines

  1. Attribute VB_Name = "Module1"
  2. Sub Main()
  3. Dim oADsContainer
  4. Dim oADsNewUser
  5. Dim oGuidGen
  6. Dim strGuid
  7. Dim strLdapPath 'The path to the ou=Members container
  8.  
  9. strLdapPath = "LDAP://andyhar11:5292/o=Microsoft/ou=Members"
  10.  
  11. 'Instantiate the GUID Generator that comes with Site Server
  12. 'and store the GUID for use later on.
  13. Set oGuidGen = CreateObject("Membership.GuidGen.1")
  14. strGuid = oGuidGen.GenerateGuid
  15.  
  16. 'Bind to the container in which the Member will be created
  17. Set oADsContainer = GetObject(strLdapPath)
  18.  
  19. 'Create the new user object, note that the Create() method returns
  20. 'an interface pointer
  21. Set oADsNewUser = oADsContainer.Create("member", "cn=JohnDoe")
  22. oADsNewUser.Put "givenName", "John"
  23. oADsNewUser.Put "sn", "Doe"
  24. oADsNewUser.Put "userPassword", "password"
  25. oADsNewUser.Put "GUID", CStr(strGuid)
  26. oADsNewUser.SetInfo
  27.  
  28. 'Destroy the objects
  29. Set oGuidGen = Nothing
  30. Set oADsNewUser = Nothing
  31. Set oADsContainer = Nothing
  32.  
  33. End Sub
  34.