public Boolean ReadMail()
{
var session = new NotesSession();
session.Initialize("aq1sw2de");
var db = session.GetDatabase("", "c:\\notes\\data\\names.nsf", false);
if (db == null) throw new ArgumentNullException("cannot load database");
var collection = db.CreateNoteCollection(false);
collection.SelectScriptLibraries = true;
collection.BuildCollection();
var dxlExporter = session.CreateDXLExporter();
dxlExporter.OutputDOCTYPE = false;
var noteId = collection.GetFirstNoteId();
while (noteId != null)
{
var doc = db.GetDocumentByID(noteId);
var xml = dxlExporter.Export(doc);
String Subject = ((object[])doc.GetItemValue("Subject"))[0] as String;
MessageBox.Show(Subject);
//do something with DXL
noteId = collection.GetNextNoteId(noteId);
}
return true;
}
网友评论