Quick-n-Dirty: How to use the NAPI in a Java Agent

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.

Dieser Beitrag wurde unter Agenten, Java abgelegt und mit , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Ein Kommentar zu Quick-n-Dirty: How to use the NAPI in a Java Agent

  1. Stefano Fois sagt:

    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 ();
    }
    }
    }

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.