Create Roaming User using Java API

Hi All,

I am working on a Lotus Notes Integration project. Currently we are using a Java client application, which uses NCSO.jar. The main usage is to register new users.

The current requirement is to create new user on the defined mail server and create the roaming profile on the same server. If I use the LotusNotes admin server as the mail server and roaming server, ti creates the new user and roaming files. But If I use a different server to create the mail file, current code can’t create roaming files. Could you help me to create the roaming files to create in the same mail server please.

Currently there is one registration policy in the test environment.

Following is the current code,

private void connect() throws NotesException { if (session == null) { session = NotesFactory.createSession(config.getAdminServer() + “:” + config.getAdminServerPort(), config.getAdminUsername(), config.getAdminPassword()); } }

private void registerNewUser(DominoNewUserDetails newUser) throws NotesException, CertifierIdFileNotFoundException { connect(); String certifierIdFile = calculateCertifierIdFileName(newUser .getCertifierId()); String newUserIdFile = config.getNewUserCertificateDir() + newUser.getUserName() + CERTIFICATE_FILE_EXTENSION; String mailFile = config.getMailFileDir() + newUser.getUserName(); Registration reg = session.createRegistration(); // Setup the registration/administration server and the appropriate // cert.id reg.setRegistrationServer(config.getAdminServer()); reg.setCertifierIDFile(certifierIdFile); reg.setCreateMailDb(config.isCreateMailDb()); // Setup the mail quotas, warning and template reg.setMailQuotaSizeLimit(config.getMailQuotaSizeLimit()); reg.setMailQuotaWarningThreshold(config.getMailQuotaWarningThreshold()); reg.setMailTemplateName(config.getMailTemplate()); // Setup the users internet email address and short name reg.setMailInternetAddress(newUser.getUserName() + config.getOxfamMailDomain()); reg.setShortName(newUser.getUserName()); // Setup the expiry date to be 24 months from today DateTime dt = session.createDateTime(“Today”); dt.setNow(); dt.adjustYear(config.getAccountExpiryYears()); reg.setExpiration(dt); // Set the ID type, minimal password length and as International reg.setIDType(Registration.ID_HIERARCHICAL); reg.setMinPasswordLength(config.getMinPasswordLength()); // password // strength reg.setNorthAmerican(config.isNorthAmerica()); // Setup registration log file for logging information // and tell it to update the address book but not store // the ID file in the address book reg.setRegistrationLog(config.getRegistrationLog()); reg.setUpdateAddressBook(config.isUpdateAddressBook()); reg.setStoreIDInAddressBook(config.isStoreIdInAddressBook()); // Setup the policy details reg.setPolicyName(config.getPolicyName()); // Setup the roaming details reg.setRoamingUser(config.isRoamingUser()); reg.setRoamingServer(newUser.getMailServer()); reg.setRoamingSubdir(config.getRoamingSubdirPrefix() + newUser.getUserName()); // Setup the server list for replicas of this mail file // of Strings // reg.setMailReplicaServers(config.getReplicaServers()); // Setup the group list to add this user to // of Strings reg.setGroupList(newUser.getGroupList()); try { boolean regStatus = reg.registerNewUser(newUser.getLastName(), // last // name newUserIdFile, // id file to be created /* * the admin server has been specified as the mail server to * address the issue when creating the mail database on the mail server */ config.getAdminServer(), // mail server // newUser.getMailServer(), // mail server newUser.getFirstName(), // first name newUser.getMiddleInitial(), // middle initial config.getCertifierPassword(), // certifier password newUser.getLocation(), // location field newUser.getComment(), // comment field mailFile, // mail file config.getForwardingDomain(), // forwarding domain newUser.getPassword()); // new user password } catch (NotesException e) { if (e.text.equals(“Notes error: Could not open the ID file”) && (e.id == 4000)) { throw new CertifierIdFileNotFoundException( “The certifier id file " + certifierIdFile + " was not found on the Domino Server.”, e); } else { throw e; } } }

Subject: I noticed

I noticed this in the code

/* * the admin server has been specified as the mail server to * address the issue when creating the mail database on the mail server */
Where are you setting a value to the mail server that you want to create the mail file and roaming files

Subject: Client program set the server names

Hi Barry,

Thanks for the reply.

The current test environment has three Lotus Notes server. One server is acting as the admin server (Test01) and other two servers (Test02, Test03) are normal servers.

There is a bean class called DominoConfig, it has the attributes, admin server, mail server and roaming server.

From the client program values are set dynamically.

Still the main problem is, if client program sets the values to use admin server, mail server and roaming server as Test01, then code creates the mail file and roaming files.

But the code points to create the mail files in Test02 or Test03, which are not admin servers, only mail file is created and roaming files are not created.