Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lotus notes 访问ACL条目_Lotus Notes - Fatal编程技术网

Lotus notes 访问ACL条目

Lotus notes 访问ACL条目,lotus-notes,Lotus Notes,有人可以解释为什么这个代码不起作用。我在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 = Sour

有人可以解释为什么这个代码不起作用。我在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中有条目。

我稍微更改了代码,它就可以工作了:

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

这是在任何地方记录的,还是简单地被破坏的。

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

您应该更新您的问题,而不是将其放在回答中。是的,当您“链接”依赖于状态信息的方法时,会出现这个问题。我知道我已经看到了描述的问题——可能是Bob Balaban在他关于用Java编程Domino的旧书中,或者在一次演示中描述的。不知道它是否在正式文件中。第一种编写方式是,用于获取第一个条目的ACL对象与用于获取下一个条目的ACL对象不同,因此状态丢失。一般来说,对于Notes对象类,在处理完子对象之前,始终需要将父对象保留在作用域中。@Ken,是的,但是现在移动和删除注释已经太晚了。