I am working on a script to set quota’s 500 meg above the current database size.
It has been curious to work with as the size is in bytes, but the quota is in kbytes.
works great if the mail file is less than 1Gig in size. I trying to add 500Meg to existing quotas - so for a 4 gig mail file - the quota entry via the Admin client would be 4500MB.
I get an overflow error when working with numbers that large. Even if the numbers are set to type double.
It works great for any db <1G in size. I have a user - the 4th one (as it executes alphabetically - last name) the first 3 work fine.
THe last (4Gig) dies with overflow.
Dim dbsizeG As Long
Dim dbsizeM As Long
Dim dbsizeK As Long
Dim oldquota As Long
Dim newquota As Long
Dim nab As NotesDatabase
Dim nabview As NotesView
Dim c As Double
Set s = New NotesSession
Set curdb = s.CurrentDatabase
Set curdoc = New NotesDocument(curdb)
Set nab = New NotesDatabase("","names.nsf")
Set nabview = nab.GetView("People")
Set pdoc = nabview.GetFirstDocument
c=c+1
While Not (pdoc Is Nothing)
Set userdb = New NotesDatabase( pdoc.mailserver(0), pdoc.mailfile(0) )
If userdb.isopen = True Then ' makes sure there is a database there
dbsizeG = Clng(userdb.Size)
dbsizeM = (dbsizeG\1024)
I have tried dbsize\1024# or 1024.0 etc.
I need to make the database size in bytes match the quota size measured in kbytes.
You’ll have to find the floor yourself. The integer division operator appears to mean literally that – it works in Integers (not Longs). Do a floating-point division, then use Fix to get the floor.