日期:2014-05-20 浏览次数:21107 次
try{ String idfile="G:\\testNsf\\admin.id"; String pwd="123"; NotesThread.sinitThread(); // 启动线程 Session session = NotesFactory.createSession(); Registration r=session.createRegistration(); r.switchToID(idfile,pwd); //关键!此外即为身份验证的代码 Database db = session.getDatabase("", "G:\\testNsf\\administ.nsf",true); View vw = db.getView ("($Sent)"); Document doc = vw.getFirstDocument(); int i=1; while (doc != null) { System.out.println("----------------------第"+i+"封邮件"); System.out.println ("Subject:"+doc.getItemValueString("Subject")); doc = vw.getNextDocument(doc); i++; } }catch(NotesException e){ e.printStackTrace(); }finally { NotesThread.stermThread(); // 结束该线程 }