2.代理ChangePass的源代码。
Sub Initialize
Dim dt As New Notesdatetime("")
‘注释——获取当前的系统时间
Dim Session As New NotesSession
‘注释——获取当前的Session
Dim NamesDb As Notesdatabase
Dim docs As NotesDocumentCollection
Dim doc As Notesdocument,Namesdoc As Notesdocument
Dim formula As String
Dim new_pass As String
On Error Goto ErrProc
‘注释——出错则跳转到ErrProc
Set NamesDb = Session.GetDatabase("","names.nsf")
‘注释——打开数据库names.nsf
Set doc = Session.DocumentContext
‘注释——获取当前文档
If doc.new_pass(0) <> doc.new_pass1(0) Then
Print "新口令输入有误,请重新输入!"
Exit Sub
End If
new_pass = doc.new_pass(0)
Formula = "Form = 'Person' %26amp; ShortName='" + doc.ShortName(0) + "' %26amp; HttpPassword= '"+doc.HttpPassword(0)+"' "
‘注释——产生文档搜索标准
Set docs = NamesDb.Search(Formula,dt,0)
‘注释——得到文档搜索结果
If docs.count <> 1 Then
Print "用户名或口令出错,请检查!"
Else
Set Namesdoc = docs.Getfirstdocument
‘注释——获得记录用户信息的文档
Namesdoc.HttpPassword = New_Pass
Call namesdoc.save(True,False)
‘注释——修改用户的口令,并保存文档
Print "口令修改成功!"
End If
Exit Sub
ErrProc :
Print "系统错误"
End Sub