Lotus脚本Lockout用户如何获取备忘录中的useres列表

时间:2018-03-09 14:13:57

标签: lotus-notes lotusscript lotus

manual_fields=[
        coreapi.Field(
            "data",
            required=True,
            location="body",
            description='{"items":[], "name":str}',
            schema=coreschema.Object()
        ),
    ])

可以获取锁定备忘录(电子邮件)的用户列表吗?也许有一种方法可以在lotusscript中显示和发送这种类型的视图?

尝试

    Sub Initialize

On Error GoTo e
Dim session As New NotesSession, db As NotesDatabase, view As NotesView
Dim nvec As NotesViewEntryCollection
Dim c As integer
Set db = session.currentdatabase

Set view = db.getView("Locked Out Users")
Set nvec = view.Allentries

c = nvec.count

If c > 0 Then

Call nvec.Removeall(true)

' Send notification
Dim sarr(1) As String
sarr(0) = "john.doe@acme.com"
sarr(1) = "foo@acme.com"

Dim mdoc As NotesDocument, rt As notesrichtextitem
Set mdoc = db.createdocument
mdoc.Form = "Memo"
mdoc.Subject = "Removed " + CStr(c) + " Locked out users on mypage"
Set rt = mdoc.Createrichtextitem("Body")
Call rt.Appendtext("Removed " + CStr(c) + " Locked out users")
Call rt.Addnewline(1) 
Call rt.Appendtext("Click to open lockout database")
Call rt.Appenddoclink(db,"Lockout")
Call mdoc.Send(False, sarr)

End If
Exit Sub
e:
Print Error,erl
End Sub

设置item = doc.getItemValue(“ILUserName”)

每次他只收到他们的号码

1 个答案:

答案 0 :(得分:1)

你需要将nvec.Removeall放到代码的末尾,因为它会删除所有被锁定的用户。

然后初始化您的richtext并在集合中循环并将每个名称放在richtext中:

Dim ve as NotesViewEntry
Dim doc as NotesDocument

…

Call rt.Appendtext("Removed " + CStr(c) + " Locked out users")
Call rt.Addnewline(1)
Call rt.Appendtext("Removed the following users:")
Call rt.Addnewline(1)
view.AutoUpdate = False 'necessary in case a user is locked while the code runs then your reference migth become broken...
Set ve = nvec.GetFirstEntry()
While not ve is Nothing
  If ve.IsDocument then
    Set doc = ve.Document
    Call rt.AppendText( doc.IlUserName(0) )
    Call rt.Addnewline(1)
  End If
  Set ve = nvec.GetNextEntry( ve )
Wend
Call nvec.RemoveAll(True)
…
' the rest code with the database link comes here.