如何从NotesAgent变量中删除"$ MachineName"项?或者我如何将NotesAgent转换为NotesDocument以便我可以删除此项目?

use*_*708 1 lotus-notes lotusscript

我有以下代码:

Forall agent In db.agents
  'I need to remove "$MachineName" item from all agents
End Forall
Run Code Online (Sandbox Code Playgroud)

如何从NotesAgent中删除"$ MachineName"项?或者我如何将NotesAgent转换为NotesDocument以便我可以删除此项目?

Knu*_*ann 7

您必须将代理作为设计元素.这可以通过NotesNoteCollection课程来实现:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim i As long
Dim nc As NotesNoteCollection
Dim noteid As string

Set db = session.CurrentDatabase
Set nc = db.CreateNoteCollection(False)
nc.SelectAgents = true
Call nc.BuildCollection
noteid = nc.Getfirstnoteid()
For i=1 To nc.Count
    Set doc = db.Getdocumentbyid(noteid)
    Call doc.Removeitem("$MachineName")
    Call doc.Save(true, true)
    noteid = nc.Getnextnoteid(noteid)
Next
Run Code Online (Sandbox Code Playgroud)

  • 但是,这将使设计元素上的签名无效,因此,如果您仍希望它运行,则必须使用 Sign 方法使用服务器识别为已授权的 ID 对设计注释进行签名。 (2认同)