Access Lotus Notes mailbox from java application

Posted on 2007-10-02
Last Modified: 2013-12-18
After lots of searching, I haven't been able to find an answer to this question. What I would like to do is access a shared Lotus Notes (7.0.2) mailbox via a java application in order to extract attachments from all mails that arrive. Firstly is this possible, and second how?

This is the sort of thing I'm trying (just trying to connect to the database, I'll worry about extracting the attachements later)

      Session s = NotesFactory.createSession(<server>, <username>, <password>);
      Database d = s.getDatabase(<server>, <database>);;

.. but I get a connection refused message. I am also surprised that the code I have seen makes no reference to an id file, I though I would need this to validate the connection.

Any help greatly appreciated.

Question by:Scoteq
    LVL 63

    Expert Comment

    LVL 1

    Accepted Solution

    Thanks for the comments.

    I am running the code on the client, in a stand alone application. The key point that I was missing was switching to an id file. For info, the following code works for me:

          Session s = NotesFactory.createSession();
          Registration reg = s.createRegistration();
          String un = reg.switchToID(<id_file>,<password>);
         if (un.equals(""))
                    System.out.println("File does not exist or not a user ID");
                    System.out.println("User name = " + un);
          Database d = s.getDatabase(<server>, <dbname>);
          if (!d.isOpen());
          // Code to read documents and extract files
    LVL 63

    Expert Comment

    Glad you resolved this.

    Yes, the ID file is critical, since otherwise the Domino Security prevents access.

    Glad you resolved this !
    LVL 1

    Expert Comment

    Closed, 500 points refunded.
    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
    Article by: Rob
    Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now