M
morpheus
Код:
...
Dim uReg As NotesRegistration
Dim nLen As Integer
Dim sComment As String
Dim sLocation As String
Dim sMailFile As String
Sub Initialize
Set uReg = New NotesRegistration
With uReg
nLen = Len(uDocument.idfile(0))
.CertifierIDFile = sLocalCertID
.CreateMailDb = True
.Expiration = CDat("01.01.2007")
.IDType = ID_HIERARCHICAL
.IsNorthAmerican = False
.MailACLManager = uSession.UserName
.MailOwnerAccess = REG_MAIL_OWNER_ACL_MANAGER
.MailTemplateName = sMailTemplate
.MinPasswordLength = 3
.OrgUnit = uDocument.OrgUnit(0)
.RegistrationServer = Canonicalize(uDocument.regserver(0))
.ShortName = Left(uDocument.idfile(0), nLen - 3)
.StoreIDInAddressbook = True
.UpdateAddressbook = False
sComment = "Automatically Created"
sLocation = "Office"
sMailFile = uDocument.maildbpath(0)
If (Right(sMailFile, 4) = ".nsf") Then
sMailFile = Left(sMailFile, Len(sMailFile)-4)
End If
sMailFile = sMailFile & ".nsf"
If Not(.RegisterNewUser(_
F.LastName, _ ' Last Name
sLocalUserIDDirectory & "\" & _
uDocument.idfile(0), _ ' ID-file to be created
.RegistrationServer,_ ' Mail Server
F.FirstName, _ ' First Name
F.MiddleInit, _ ' Middle Initial
sCertPassword, _ ' Certifier Password
sLocation, _ ' Location Field
sComment, _ ' Comment Field
sMailFile, _ ' Mail File
"", _ ' Forwarding Domain
uDocument.userpw(0), _ ' User Password
NOTES_FULL_CLIENT, _ ' User Type
, _ ' Alternate Name
"ru"_ ' Alternate Language
)) Then
Print sError & "RegisterUser: uReg.RegisterNewUser: FAILED"
Exit Function
Else
Print sNote & "RegisterUser: uReg.RegisterNewUser: OK"
End If
If Not(.AddUserToAddressbook(_
sLocalUserIDDirectory & "\" & _
uDocument.idfile(0), _ ' ID-file
F.FullName, _ ' Full Name
F.LastName, _ ' Last Name
uDocument.userpw(0), _ ' User Password
F.FirstName, _ ' First Name
F.MiddleInit, _ ' Middle Initial
.RegistrationServer, _ ' Mail Server
sMailFile, _ ' Mail File
"", _ ' Forwarding Address
sLocation, _ ' Location Field
sComment _ ' Comment Field
)) Then
Print sError & "RegisterUser: uReg.AddUserToAddressbook: FAILED"
Exit Function
Else
Print sNote & "RegisterUser: uReg.AddUserToAddressbook: OK"
End If
End With
If Not(SetPersonFullName(uReg.RegistrationServer, _
F.LastName, F.FirstName, F.MiddleInit, uReg)) Then
Print sError & "RegisterUser: SetPersonFullName: FAILED"
Exit Function
Else
Print sNote & "RegisterUser: SetPersonFullName: OK"
End If
...
End Sub
Function SetPersonFullName(sRegServer As String, sLastName As String, sFirstName As String, sMiddleInit As String, uReg As NotesRegistration) As Variant
On Error GoTo Error_
SetPersonFullName = False
Dim uPerson As NotesDocument
Set uPerson = GetPersonDoc(sRegServer, sLastName, sFirstName, sMiddleInit)
If (uPerson Is Nothing) Then
Print sError & "Пользователь """ & sLastName & " " & sFirstName & " " & sMiddleInit & """ не найден в адресной книге на сервере """ & sRegServer & """"
Exit Function
End If
With uPerson
.FullName = Canonicalize(.FullName(0))
.ShortName = uReg.ShortName
SetPersonFullName = .Save(True, True)
End With
Exit_:
Exit Function
Error_:
Print sError & "SetPersonFullName: (#" & Err() & ", #" & Erl() & ") " & Error()
Resume Exit_
End Function
Ссылка скрыта от гостей
на обсуждениеАвтор -
Ссылка скрыта от гостей
Последнее редактирование: