查找 Lotus Notes 文档所在的文件夹
Find the folder in which a lotus notes document is present
我正在使用 DIIOP 访问 Lotus Notes。我正在尝试查找存在电子邮件的文件夹。我有邮件的 Unid 来查找文件夹。
启用文件夹引用对我来说不是一个选项,因为我将在 运行 多年的生产系统上工作。
有什么方法可以使用 DIIOP 找到其中存在邮件的文件夹 unid/name?
没有文件夹引用,文档就没有关于所在文件夹的信息。
唯一的可能是遍历所有文件夹并检查文档是否在 allentries- 集合中。
代码可能看起来像这样(我不擅长 Java,所以这是 LotusScript- 代码,但是 Java 将使用相同的方法/类):
Dim db as NotesDatabase
Dim doc as NotesDocument
Set db = ... database that you work on
Set doc = .... document that you work on
Dim fc As NotesViewEntryCollection
Dim fe As NotesViewEntry
ForAll f In db.AllViews
If f.IsFolder Then
Set fc = f.AllEntries '- get all entries in folder
Set fe = fc.GetEntry( doc ) '- try to get object for doc from folder
If not fe is Nothing then
'- This document is in this folder... remember foldername, do whatever....
End If
End If
End ForAll
@Torsten 的回答是正确的,但对很多文档(一次一个文档)执行此操作确实效率低得离谱——尤其是在 IIOP 上。
如果您要为大量文档执行此操作,我会将它们全部添加到 NotesNoteCollection 对象中。然后为每个文件夹构建另一个 NotesNoteCollection 对象并使用 Intersect 方法查找两个集合共有的所有文档,然后移动到下一个文件夹等。
我正在使用 DIIOP 访问 Lotus Notes。我正在尝试查找存在电子邮件的文件夹。我有邮件的 Unid 来查找文件夹。
启用文件夹引用对我来说不是一个选项,因为我将在 运行 多年的生产系统上工作。
有什么方法可以使用 DIIOP 找到其中存在邮件的文件夹 unid/name?
没有文件夹引用,文档就没有关于所在文件夹的信息。
唯一的可能是遍历所有文件夹并检查文档是否在 allentries- 集合中。
代码可能看起来像这样(我不擅长 Java,所以这是 LotusScript- 代码,但是 Java 将使用相同的方法/类):
Dim db as NotesDatabase
Dim doc as NotesDocument
Set db = ... database that you work on
Set doc = .... document that you work on
Dim fc As NotesViewEntryCollection
Dim fe As NotesViewEntry
ForAll f In db.AllViews
If f.IsFolder Then
Set fc = f.AllEntries '- get all entries in folder
Set fe = fc.GetEntry( doc ) '- try to get object for doc from folder
If not fe is Nothing then
'- This document is in this folder... remember foldername, do whatever....
End If
End If
End ForAll
@Torsten 的回答是正确的,但对很多文档(一次一个文档)执行此操作确实效率低得离谱——尤其是在 IIOP 上。
如果您要为大量文档执行此操作,我会将它们全部添加到 NotesNoteCollection 对象中。然后为每个文件夹构建另一个 NotesNoteCollection 对象并使用 Intersect 方法查找两个集合共有的所有文档,然后移动到下一个文件夹等。