AllDocuments Collection & Count (Calendar + Emails)

I’m posting the V8 forum, too. If there are advancements that would help, we’ll consider upgrading the server. I guess this really needs to be changed to the following since db is used for the person docs.

Current script looks like this…

Sub Initialize

Dim db As notesdatabase

Dim session As New notessession

Dim pdoc As notesdocument

Dim view As notesview

Set db = session.currentdatabase

Set view = db.getview(“People”)

Set pdoc = view.getfirstdocument

While Not pdoc Is Nothing

Dim maildb As notesdatabase

Dim mailserver As String

Dim collection As NotesDocumentCollection

Dim n As Integer

Dim mailfile As String

Dim percentused As Double

Dim size As Double

mailserver = pdoc.MailServer(0)

Messagebox mailserver

mailfile = pdoc.MailFile(0)

Messagebox mailfile

Set maildb= session.getdatabase(mailserver, mailfile)

Set mailsession = session.CurrentDatabase

Set collection = maildb.AllDocuments

n = collection.Count

pdoc.dbcount = n

size = maildb.size / 1048576

pdoc.dbsize = size

percentused = maildb.percentused

pdoc.dbpercent = percentused

Call pdoc.Save ( True, True )

Set pdoc = view.getnextdocument(pdoc)

Wend

End Sub

Update: I am lost… help! :slight_smile: Been trying to make this work all day… any advice? Thanks… am just not certain how to make sure the collection value is clear for the next document. Is there a way using this to show the #s for calendar entries and emails? I saw something similar with FTSearch… but not all databases are indexed (but read it would work in a degraded state).