Retrieve version of Lotus Notes by java
This task use java to retrieve version of Lotus Notes.
Extract version of Lotus Notes
- Create getNotesVersion method as following
- Call getNotesVersion method as following
try {
String idfile = "path to your id file";
String password = "your password";
NotesThread.sinitThread();
Session s = NotesFactory.createSessionWithFullAccess();
s.createRegistration().switchToID(idfile, password);
String version = getNotesVersion(s);
logger.info(version);
} catch (Exception e) {
logger.info("", e);
}
getNotesVersion method
private String getNotesVersion(Session session) throws Exception {
String version = session.getNotesVersion();
int pos = version.indexOf("|");
if (pos >= 0) {
version = version.substring(0, pos);
}
pos = version.indexOf("Release ");
if (pos >= 0) {
version = version.substring(pos + 8);
}
return version;
}
No comments:
Post a Comment