Reputation: 135
I am accessing lotus notes using DIIOP. I am trying to find the folder in which a email is present. I have Unid of the email to find the folder.
Enabling folder references is not an option for me, because I will be working on a production system which is running for years.
Is there any way I can find a the folder unid/name in which a mail is present using DIIOP?
Upvotes: 1
Views: 2695
Reputation: 14628
@Torsten's answer is correct, but it would really be ridiculously inefficient to do it for a lot of documents, one document at a time - and especially over IIOP.
If you're doing it for lots of documents, I would add them all to a NotesNoteCollection object. Then for each folder I would build another NotesNoteCollection object and use the Intersect method to find all the documents in common to both collections, then move to the next folder, etc.
Upvotes: 1
Reputation: 12080
Without folder references the document does NOT have the information about the folder in which is resided.
The only possibility is to go through all folders and check, if the document is in the allentries- collection.
Code could look somehow like this (I am not good in Java, so this is LotusScript- Code, but Java will use the same methods / classes):
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
Upvotes: 2