有人可以解释为什么这段代码不起作用。我在"作者"字段中没有得到任何值,也没有打印任何内容。
Sub Querysave(Source As Notesuidocument, Continue As Variant)
' Add users with role R* to Authors
Dim s As New NotesSession
Dim e As NotesACLEntry
Dim it As NotesItem
Set it = Source.Document.GetFirstItem("Authors")
Set e = s.CurrentDatabase.ACL.GetFirstEntry
While Not e Is Nothing
Print e.Name
If e.IsRoleEnabled("R1") Then it.AppendToTextList(e.Name)
If e.IsRoleEnabled("R2") Then it.AppendToTextList(e.Name)
Set e = s.CurrentDatabase.ACL.GetNextEntry(e)
Wend
End Sub
数据库位于服务器上,并且在 ACL 中具有条目。
我相信
在 LotusScript 中的其他地方需要创建这样的单独变量。 所有示例都是这样编写的。 毫无疑问,这是一个错误,我怀疑它是否被记录在案。
我稍微更改了代码,它可以工作:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
' Add users with role R* to Authors
Dim s As New NotesSession
Dim acl As NotesACL
Dim e As NotesACLEntry
Dim it As NotesItem
Set it = Source.Document.GetFirstItem("Authors")
Set acl = s.CurrentDatabase.ACL
Set e = acl.GetFirstEntry
Print e Is Nothing
While Not e Is Nothing
Print e.Name
If e.IsRoleEnabled("R1") Then it.AppendToTextList(e.Name)
If e.IsRoleEnabled("R2") Then it.AppendToTextList(e.Name)
Set e = acl.GetNextEntry(e)
Wend
End Sub
这是记录在任何地方还是简单地损坏。