使用DocumentCollection dc = agentContext.getUnprocessedDocuments();
不管选择了几笔文档,dc.getCount()总等于1,这是为什么呢
------解决方案--------------------
你代理是怎么设置的?是怎么调用的?“运行目标” 是否选择为“所有选定文档”
帮助里面的例子
If this agent runs on selected documents, getUnprocessedDocuments returns the selected documents.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
DocumentCollection dc =
agentContext.getUnprocessedDocuments();
System.out.println("Count = " + dc.getCount());
Document doc = dc.getFirstDocument();
while (doc != null) {
System.out.println(
doc.getItemValueString("Subject"));
doc = dc.getNextDocument();
}
} catch(Exception e) {
e.printStackTrace();
}
}
}