有人可以解释为什么这段代码不起作用。我没有在作者字段中获得任何值,也没有打印任何内容。
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中有条目。
答案 0 :(得分:1)
我稍微更改了代码并且可以正常工作:
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
这是在任何地方记录或简单破坏。
答案 1 :(得分:1)
我相信LotusScript中还有其他地方需要创建这样的单独变量。所有的例子都是这样编写的。毫无疑问,这是一个错误,我怀疑它是有记录的。