wenn dem wirklich so ist, dann lässt sich das Jahr, in dem das erste Dokument in der MailDB erstellt wurde mit folgenden Code bestimmen:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim dt As Variant
Set db = session.CurrentDatabase
Set col = db.Search( {@Contains(@UpperCase(Form);"MEMO":"REPLY")}, Nothing,0)
If col.Count > 0 Then
Set doc = col.GetFirstDocument
dt = Evaluate ( {@Year(@If(DeliveredDate != ""; DeliveredDate; PostedDate != ""; PostedDate; @Created))}, doc )
Print dt(0)
End If
End Sub
So, 45 Minuten und 40 Zeilen Code später habe ich jetzt soweit alles, was ich brauche:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim dt As Variant
Dim intDocs As Integer
Dim dblLenght As Double
Dim strYear As String
Dim varRes As Variant
Dim dblSize As Double
Dim intAtt As Integer
Set db = session.CurrentDatabase
Set col = db.Search ( MACRO_HAS_ATTACHMENTS , Nothing,0)
If col.Count > 0 Then
intDocs = 0
dblSize = 0
intAtt = 0
Set doc = col.GetFirstDocument
dt = Evaluate (MACRO_THE_YEAR, doc )
strYear = dt(0)
While ( Not doc Is Nothing )
dt = Evaluate ( MACRO_THE_YEAR, doc )
If (Not strYear = dt(0) ) Then
Print strYear & " Docs: " & Cstr (intDocs) & " Size: " & Cstr(dblSize) & " Count: " & Cstr(intAtt)
strYear = dt(0)
intDocs = 0
dblSize = 0
intAtt = 0
End If
varRes = Evaluate ( {@Sum(@AttachmentLengths)}, doc )
dblSize = dblSize + varRes(0)
varRes = Evaluate ( {@Attachments}, doc )
intAtt = intAtt + varRes(0)
intDocs = intDocs +1
Set doc = col.GetNextDocument (doc)
Wend
End If
End Sub
Der Code wirft mir die Anzahl der Documente, die Anhänge enthalten pro Jahr aus. Dabei wird die Anzahl der Attachments ermittelt und die Länge der Attachments summiert.