2010-11-24 85 views
5

我怎样才能得到所有Lotus Notes从一NSF文件的Lotus Notes收件箱中与C#和互操作的使用文档(例如邮件,其内容) .domino.dll读的Lotus Notes从NSF文件的文件和项目与C#

我想用下面的代码片段:

Domino.NotesSession m_session = null; 

... 

this.m_session = new Domino.NotesSession(); 
this.m_session.Initialize(""); 

Domino.NotesDatabase db = null; 
this.m_session.GetDatabase("", "C:\test.nsf", false); 

Domino.NotesDocumentCollection col = db.AllDocuments; 

for (int i = 0; i < col.Count; ++i) 
{ 
     Domino.NotesDocument doc = col.GetNthDocument(i); 

     ... 
} 

如何访问每个文档的项目?例如,我想要主题,谁,日期,时间,...

如何迭代通过文档的所有项目?

如何提取附件?

NotesSQL ODBC驱动程序是COM API的一个很好的选择吗?

+0

到目前为止,你有什么试过? – 2010-11-24 14:15:23

回答

5

这应该工作。 Lotuss的GetItemValue方法返回一个值数组,但通常你只需要在第一个索引处的值。我不确定它是否和COM一样工作,但调试器可以帮助你弄清楚。

另外,如果您正在处理大量文档,则使用GetFirstDocument/GetNextDocument方法进行迭代要比使用GetNthDocument方法快得多。

Domino.NotesDocument doc = col.GetFirstDocument(doc); 
while (doc != null) { 

    string subject = doc.GetItemValue("subject")[0]; 
    string who = doc.GetItemValue("sendto")[0]; 

    Domino.NotesDocument doc = col.GetNextDocument(doc); 
} 
+0

为什么没有阅读备忘录草稿? – Elmex 2010-11-24 16:26:47