1

有人可以解释为什么这段代码不起作用。我在 Authors 字段中没有得到任何值,也没有打印任何内容。

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 中有条目。

4

2 回答 2

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

这是在任何地方记录还是简单损坏。

于 2012-05-04T15:17:02.627 回答
1

我相信 LotusScript 中还有其他地方需要创建类似的单独变量。所有的例子都是这样写的。毫无疑问,这是一个错误,我怀疑它是否已记录在案。

于 2012-05-04T22:46:48.570 回答