Dim reg As New notesregistration
Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim doc As notesdocument
Set doc = session.documentcontext
reg.createmaildb = False
reg.certifieridfile = "cert.id"
reg.expiration = Today + 2190
reg.registrationserver = db.server
reg.idtype = id_certifier
reg.isnorthamerican = False
reg.minpasswordlength = 5
reg.orgunit = ""
reg.updateaddressbook = True
reg.storeidinaddressbook = True
Dim firstname As String
Dim lastname As String
firstname = doc.firstname(0)
lastname = doc.firstlast(0)
Call reg.registernewuser(lastname, "u4", _
db.server, firstname,"", "yourcertidnumber", "", _
"", "", "", _
"00000000", notes_full_client)
为该用户设置internet登录口令
Dim dbnames As notesdatabase
Set dbnames = session.getdatabase("","names.nsf",False)
If dbnames.isopen = False Then
Call dbnames.open("","names.nsf")
End If
Dim vwperson As notesview
Set vwperson = dbnames.getview("($users)")
Dim docuser As notesdocument
Set docuser = vwperson.getdocumentbykey(firstname & " " & lastname)
docuser.httppassword = doc.idsetpassword(0)
Call docuser.save(True,False)