用C#从NSF文件中读取Lotus Notes文档和项目(Read Lotus Notes documents and items from NSF file with C#)

编程入门 行业动态 更新时间:2024-10-26 18:29:44
用C#从NSF文件中读取Lotus Notes文档和项目(Read Lotus Notes documents and items from NSF file with C#)

我如何从包含C#的NSF文件以及interop.domino.dll的使用情况,从Lotus Notes收件箱中获取所有Lotus Notes文档(例如邮件及其内容)?

我想使用下面的代码片段:

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的一个很好的选择吗?

How can I get all Lotus Notes documents (e.g. mails and their content) from a Lotus Notes inbox from an NSF Files with C# and the usage of interop.domino.dll?

I want to use the following snippet:

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

How can I access the items of each document? For example I want subject, who, date, time,...

How can I iterate throug all items of a document?

How can I extract attachments?

Is the NotesSQL ODBC driver a good alternative to the COM API?

最满意答案

这应该工作。 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); }

This should work. The GetItemValue method in Lotusscript returns a value array, but usually you're just going to need the value at the first index. I'm not sure if it works the same way with COM, but the debugger can help you figure that out.

Also if you're processing a lot of documents it is much faster to iterate using the GetFirstDocument/GetNextDocument methods than it is to use the GetNthDocument method.

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

更多推荐

本文发布于:2023-07-09 14:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1087139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文档   文件   项目   Notes   NSF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!