Lotus Notes接口

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;
        }

你可能感兴趣的:(Lotus Notes接口)