Lotus脚本锁定用户如何在备忘录中获取用户列表

Lotus script Lockout users how to get list of useres in memo

    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

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

试试

Dim item As NotesItem

设置项目 = doc.getItemValue("ILUserName")

每次他只收到他们的号码

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

然后初始化您的富文本并循环遍历集合,然后像这样将每个名称放入富文本中:

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.