Reputation: 857
DocumentCollection documents = db.getAllDocuments(); Document doc = collection.getFirstDocument();
Which method used to identify the document Location. Whether it is in Inbox or Sent or Drafts.
Upvotes: 0
Views: 6450
Reputation: 9561
This problem involves 2 aspects. Folders and views. You can accomplish in two parts. Firstly, you can check this IBM technote that addresses your question in relation to folders (ie Inbox is a folder).
The "Draft" and "Sent" design elements are views, and therefore must be searched differently. You can accomplish this by using the "contains" method of the NotesViewEntryCollection like so:
Function FindDocument(view As notesView, doc As notesDocument) As Boolean
On Error Goto errHandle
Dim vec As NotesViewEntryCollection
Dim bFound As Boolean
bFound = False
Set vec = view.AllEntries
If vec.Contains(doc) Then
bFound = True
End If
FindDocument = bFound
Exit Function
errHandle:
Print Lsi_info(2) + ":" + Str(Err) + " - " + Error(Err) + _
", at line " + Str(Erl)
Exit Function
End Function
Note that you can use this function for any view not just sent/draft views.
Upvotes: 1
Reputation: 14628
Inbox is a folder. Sent and Drafts are views. Here's an approach which will work the same way for both views and folders:
Upvotes: 1
Reputation: 2359
Open the mail database in the Domino Designer and look at the views and folders. If it's a view there is a Select statement, see what documents are selected. If it's a folder, you have to know how documents are attached to the folder.
($Sent) is a view, but ($Drafts) and ($Inbox) are folders. For the latter two, you indeed have to use FolderReferences.
Upvotes: 0
Reputation: 22284
The safest way is to get a handle to each folder using db.GetView() and then look to see if the document is within that folder. For that you could use the db.AllEntries() method to get a NotesViewEntryCollection, and then call the GetEntry method to see if the document is within that collection.
If you have folder references enabled for the database, you might be able to use the folderreferences property of the Notes Document to make things easier.
Upvotes: 1