When accessing the documents in a local Lotus Notes database using vba (using vba project reference to domobj.tlb), I have the following two situations with a set of documents returned using dbobject.AllDocuments:
1. There are some documents that I can see via a Lotus Notes 8.5 Client that are not made available as part of the dbobject.AllDocuments NotesDocumentCollection. These are documents I moved to my local database several months ago. There doesn't seem to be a pattern other than the fact they seem to be "sent" items of type memo.
2. Documents that I haven't moved to my local Lotus Notes database (and are in fact not visible when accessing my local mail database via a Lotus Notes 8.5 Client) are made available as part of the dbobject.AllDocuments NotesDocumentCollection of my Local mail database. I've noticed a lot of documents that fit this description. They seem to be documents of various types (memo, reply, appointment, etc.) that I "sent" from my network resident mail database as recently as the past few days.
Note: There is no replication enabled to my local database. Documents only move to my local database when I manually move them myself.
Condensed code snippet used to iterate through all documents in the local database is shown below. The local database MailDBDocs.Count returns a value of 11,300. When I check the number of items in the local database using File > Application > Properties in the Notes 8.5 Client, it indicates there are 42,994 documents. I am assuming the large mismatch is because of deletion stubs, etc.
I am able to successfully iterate through 11,300 of the documents in the collection and inspect their contents with no problems.
If anyone has insight on these two situations, please let me know.
Public Function searchMail(ByRef dbPwd as string, _
ByRef MailServerName as string, _
ByRef MailDBName as string, _
ByRef MailDB As NotesDatabase, _
ByRef Session As NotesSession) As Boolean
Dim MailDB As NotesDatabase
Dim Session As NotesSession
Dim MailDBDocs As NotesDocumentCollection
Dim MailDoc As NotesDocument
Dim MailItem As NotesItem
Dim MailDbName As String
Dim MailServerName As String
Dim tmpString As String
Dim mdCount As Long
Dim mdIdx As Long
Set Session = New NotesSession
Set MailDB = Session.GETDATABASE(MailServerName, MailDbName)
Set MailDBDocs = inMailDB.AllDocuments
Set MailDoc = MailDBDocs.GetLastDocument
mdCount = MailDBDocs.Count
For mdIdx = 1 To mdCount
'code not shown (for brevity of this post) to get doc type/to/from/subject/msgtext here via
'Set MailItem = MailDoc.GetFirstItem(
'with arg of "Form", "Subject", "From", "SendTo", "CopyTo", "BlindCopyTo" , etc,
'Code to inspect From, To, Subject, etc. not shown (for brevity of this post)
Set MailDoc = MailDBDocs.GetPrevDocument(MailDoc)
If MailDoc Is Nothing Then
If mdIdx > mdCount Then
Exit For 'Failsafe