Subject: RE: Count Messages in mail file
I’m a little late to the game, but was looking through the forum for help on doing something similar. Mixed up a little code to get the following.
Dim session As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim count As Long
Dim temp As String
Dim temp2 As String
Set db=session.currentdatabase
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
threshold = Inputbox$( "Please enter a folder docs threshold: ", “Threshold Value”, 5000 )
sendto = Inputbox$("Send result to: ", “Recipient”, session.CommonUserName)
doc.Form = “Memo”
doc.SendTo = sendto
doc.Subject = “Listing of all folders over " & threshold & " docs”
doc.SaveMessageOnSend = True
crlf$ = Chr(13) & Chr(10)
tb$=Chr(9) & Chr(9)
On Error Resume Next
Forall v In db.views
If v.IsFolder Then
Set view=db.getview(v.name)
count=view.AllEntries.Count
If count > threshold Then
temp2=v.name & " " & tb$ & Cstr(count) & " messages in folder" & crlf$
temp=temp & temp2
Call doc.ReplaceItemValue( “Body”, temp )
End If
End If
End Forall
Call doc.Send( False )
Put into a button and send to user. Will prompt for document count threshold and a recipient name to get the mail. Will then send a email message with a list of all folders above the threshold set.
Not pretty, but it works 