NotesRegistration.Mailaclmanager =“LocalDomainAdmins”
默认情况下,它总是会给我一个混合组
如何为LocalDomainAdmins组默认设置为 [人员组]
我的编码更新
Dim reg As New NotesRegistration
Dim dt As Variant
dt = DateNumber(Year(Today)+1, Month(Today), Day(Today))
reg.RegistrationServer = mailsvr
reg.CreateMailDb = True '
reg.CertifierIDFile = certid
reg.Expiration = dt
reg.IDType = ID_HIERARCHICAL
reg.MinPasswordLength = 1
reg.IsNorthAmerican = True
reg.OrgUnit = OU
reg.RegistrationLog = "log.nsf"
reg.UpdateAddressBook = True
reg.Storeidinaddressbook = false
reg.MailInternetAddress = internetpath
reg.Shortname=doc.SelectMail(0)
reg.Mailowneraccess =2
reg.Mailcreateftindex=True
Print mailfile
Print "pass 1"
Dim acl As NotesACL
Print "pass 1-1"
Dim aclEntry As NotesACLEntry
Print "pass 1-2"
Dim dbUser As NotesDatabase
Print "pass 1-3"
Set dbUser = New NotesDatabase(mailsvr,mailfile) ' mail/person.nsf
Print "pass 1-4"
Set acl = dbUser.aCL
Print "pass 1-5"
Set aclEntry = acl.GetEntry("LocalDomainAdmins")
Print "pass 1-6"
aclentry.Usertype = ACLTYPE_PERSON_GROUP ' cannot used
print "pass 1-7"
call acl.Save()
Print "pass 1-8"
结果在服务器端出现了一些错误
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:Mail \ yonna
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-1
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-2
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-3
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-4
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-5
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理打印:传递1-6
[0924:000A-0B88] 17/08/2017 09:59:46 AM HTTP Server:代理'注册新用户'错误:未设置对象变量
答案 0 :(得分:3)
无法在NotesRegistration类中更改Mailaclmanager的条目类型。
你可以做两件事:
首先:在创建用户后进入并获取数据库,并“手动”更改条目:
Dim dbUser as NotesDatabase
Dim acl as NotesACL
Dim aclEntry as NotesACLEntry
'- do your registration here
Set dbUser = New NotesDatabase( usermailserver, usermailpath )
'- use variables for usermailserver and usermailpath that you use as parameters for registeruser
Set acl = dbUser.acl
Set aclEntry = acl.GetEntry( "LocalDomainAdmins" )
aclEntry.UserType = ACLTYPE_PERSON_GROUP
Call acl.Save()
第二:只需修改模板ACL,使其包含正确类型和访问级别的Brackets中的LocalDomainAdmins- Entry(作为[LocalDomainAdmins]):创建数据库时,它会从其模板中复制Brackets中的所有条目并删除括号
我更喜欢第一个解决方案,因为它不需要对模板进行操作,所有内容都在代码中的一个位置。
还有一件事:从来没有,我再也没有重复编写代码,至少没有一个最小的错误处理程序。对于每种编码语言都是如此。 Lotus Script中的最小错误处理程序如下所示:
On error goto ErrorHandler
'- your code goes here
EndOfRoutine:
Exit sub 'or exit function
ErrorHandler:
Print Err & ", " & Error & " in line " & Erl
Resume EndOfRoutine