2009-08-31 63 views
0

我正在从Lotus Notes访问邮件。如何从使用.NET的Lotus Notes中的“邮件”获取视图列表?

而且为了进入“收件箱”我用下面的代码:

_notesDatabase = _lotusNotesServerSession.GetDatabase(LotusNotesServer, "mail\\" + nsfName, false); 
NotesView inbox = _notesDatabase.GetView("($Inbox)"); 

同样,对于“草稿”。

但是,我在此指定GetView方法中每个视图的名称。 哪个编码不好。

我想用C#列出这些视图“收件箱”,“草稿”程序。

有人可以给我解决方案吗?

回答

1

解决办法是:

Object[] docColl = _notesDatabase.Views as Object[]; 

foreach (Object objView in docColl) { 
    NotesView view = objView as NotesView; 
    MessageBox.Show(view.Name);  
} 
1

NotesDatabase类有一个名为Views的属性,可让您访问数据库中的所有视图。你可以遍历它们来访问每个视图。

此外,这open source class called DatabaseProperties可以帮助您获得设计文件的清单,特别是在数据库中的意见,以及更多的视图的属性。

+0

_notesDatabase = _lotusNotesServerSession.GetDatabase(LotusNotesServer,“mail \”+ nsfName,false); 此后我使用 _notesDatabase.views(); 我是C#的新手。我可以显示它的值。 你能帮我解决吗? – Preeti 2009-09-01 15:00:29

+0

我得到了解决方案.Thanx Ken。 – Preeti 2009-09-01 15:59:59

0

在VB.net,基本的代码来获取所有的意见(和文件夹),并为每个,让所有包含的文件,会是这个样子:

Dim s As New notesSession 
Dim db As notesDatabase 
Set db = s.CurrentDatabase 
Dim vws As Variant 
vws = db.Views 
Forall v In vws 
    'New View being processed 
    Dim doc As notesDocument 
    Set doc = v.getFirstDocument() 
    While Not (doc Is Nothing) 
     ' do something for each document 
     ' .... 
     Set doc = v.getNextDocument(doc) 
    Wend 
End Forall 
相关问题