Wednesday, 21 December 2011

Check Lotus Notes connection by java

Check Lotus Notes connection by java
This task use java to check if Lotus Notes account (includes user id file, password) is valid or not.
Check by creating session
Call check method with try ... catch. If exception is thrown, account is not valid.
public void check(String userid, String password) throws Exception {
    Session s = NotesFactory.createSessionWithFullAccess();
    s.createRegistration().switchToID(userid, password);
    s = NotesFactory.createSessionWithFullAccess(password);

  Protected by Copyscape Online Copyright Protection

1 comment:

  1. If the password is wrong I get the following prompt at the switchToId(user,Id, password) method:

    The ID file being used is: CN=Test Test/=Development
    Enter password (press the Esc key to abort):

    The code then hangs. Is there anyway to get to the next line. Thanks.