DocumentCount
[syntax="ls"]Const wAPIModule = "NNOTES" ' Windows/32
Const NOTE_CLASS_DOCUMENT = 1
Const NOTE_CLASS_ALL = &H7FFF
Declare Private Sub IDDestroyTable Lib wAPIModule Alias "IDDestroyTable" _
( Byval hT As Long)
Declare Private Function IDScan Lib wAPIModule Alias "IDScan" _
( Byval hT As Long, Byval F As Integer, ID As Long) As Integer
Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _
( Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _
( Byval hDB As Long) As Integer
Declare Private Function NSFDbGetModifiedNoteTable Lib wAPIModule Alias "NSFDbGetModifiedNoteTable" _
( Byval hDB As Long, Byval C As Integer, Byval S As Currency, U As Currency, hT As Long) As Integer
Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _
( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer
Declare Private Sub TimeConstant Lib wAPIModule Alias "TimeConstant" _
( Byval C As Integer, T As Currency)
Function DocumentCount(db As NotesDatabase) As Long
np$ = Space(1024)
OSPathNetConstruct 0, db.Server, db.FilePath, np$
Dim hDB As Long
NSFDbOpen np$, hDB
Dim ever As Currency, last As Currency
TimeConstant 2, ever
Dim hT As Long
NSFDbGetModifiedNoteTable hDB, NOTE_CLASS_DOCUMENT, ever, last, hT
Dim RRV As Long
n& = 0
done = (IDScan(hT, True, RRV) = 0)
While Not done
If RRV > 0 Then n& = n& + 1
done = (IDScan(hT, False, RRV) = 0)
Wend
IDDestroyTable hT
NSFDbClose hDB
DocumentCount = n&
End Function[/syntax]
Const NOTE_CLASS_DOCUMENT = 1
Const NOTE_CLASS_ALL = &H7FFF
Declare Private Sub IDDestroyTable Lib wAPIModule Alias "IDDestroyTable" _
( Byval hT As Long)
Declare Private Function IDScan Lib wAPIModule Alias "IDScan" _
( Byval hT As Long, Byval F As Integer, ID As Long) As Integer
Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _
( Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _
( Byval hDB As Long) As Integer
Declare Private Function NSFDbGetModifiedNoteTable Lib wAPIModule Alias "NSFDbGetModifiedNoteTable" _
( Byval hDB As Long, Byval C As Integer, Byval S As Currency, U As Currency, hT As Long) As Integer
Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _
( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer
Declare Private Sub TimeConstant Lib wAPIModule Alias "TimeConstant" _
( Byval C As Integer, T As Currency)
Function DocumentCount(db As NotesDatabase) As Long
np$ = Space(1024)
OSPathNetConstruct 0, db.Server, db.FilePath, np$
Dim hDB As Long
NSFDbOpen np$, hDB
Dim ever As Currency, last As Currency
TimeConstant 2, ever
Dim hT As Long
NSFDbGetModifiedNoteTable hDB, NOTE_CLASS_DOCUMENT, ever, last, hT
Dim RRV As Long
n& = 0
done = (IDScan(hT, True, RRV) = 0)
While Not done
If RRV > 0 Then n& = n& + 1
done = (IDScan(hT, False, RRV) = 0)
Wend
IDDestroyTable hT
NSFDbClose hDB
DocumentCount = n&
End Function[/syntax]