The undocumented NAPI for direct API calls in Java can easily used in normal agents. You just need to add two jar files to your java agent:
- lwpd.commons.jar
- lwpd.domino.napi.jar
These files can be found in <Notes>\osgi\shared\eclipse\plugins.
After importing, you do lot of funny things, f.e. opening a Session in Full Administration Mode, etc.
NotesSession nSession = new NotesSession(); nSession.setFullAdminMode( "SERVERNAME", true );
But don’t forget: These calls are native API calls and can easily crash your system.
P.S. Keep in mind that this article has been posted in the “Quick-n-Dirty” category.
It would be very interesting to a series of articles with some examples with the use of NAPI.
I would be interested in a particular example of how to do a loop on a whole view: in practice, the translation of the following code with the NAPI
import lotus.domino. *;
javaagent {public class extends AgentBase
public void NotesMain () {
try {
Session session = getSession ();
AgentContext agentContext session.getAgentContext = ();
Database db = agentContext.getCurrentDatabase ();
View view = db.getView („By Category“);
Document tmpdoc;
Document doc = view.getFirstDocument ();
while (doc! = null) {
System.out.println („\ t“ + doc.getItemValueString („Subject“));
tmpdoc = view.getNextDocument (doc);
doc.recycle ();
doc = tmpdoc;
}
} Catch (Exception e) {
e.printStackTrace ();
}
}
}