PDA

View Full Version : Lotus Notes Mailbox Size/Quota from Excel VBA



nzeser
07-30-2013, 01:46 PM
I have no problems using VBA to send an email or create a draft message in Lotus Notes. What I'm trying to figure out is the Server Mail Size and Quota information.

What I would like to do is create a message and send it if the mailbox size is < quota, however if it's not I'd like to just save the message as a draft and notify the user that they need to reduce their mailbox size before proceeding. I would just do this on error, however there are other things that can cause errors and I'm handling each of those events differently.

Again, I know how to do everything except for determine the mailbox size and quota information, any help would be greatly appreciated, thanks!

nzeser
07-31-2013, 08:00 AM
Ok, so after reading through some IBM documentation, I've been able to get something together that sort of works. There is obviously more to my routine than below, but this is the part I'm concerned about. This finds the user's Lotus Notes db file and checks the size of that file. However, that's not exactly what I want. My "server mail size" is smaller than the user db file size. If I run the routine, it comes back that my db file size is 303MB and saves the message I've created as a draft...however my "server mail size" is really 237MB (meaning I am below the company set "quota" of 250MB and should be able to send the message just fine).

If Maildb.Size > 262144000 Then '1048576 bytes in 1 megabyte
'save message as a draft and notify user of issue
Call MailDoc.Save(True, False)
Message = "Your lotus notes mail file is: "
Message = Message & ((Maildb.Size / 1024) / 1024) & "Mb. "
Message = Message & Chr(13) & Chr(13)
Message = Message & "The company recommended mail file "
Message = Message & "size is 250Mb. " & Chr(13)
Message = Message & "Please perform housekeeping as "
Message = Message & "soon as possible."
MsgBox Message, , session.commonusername
Else
'send email message
Call MailDoc.ReplaceItemValue("PostedDate", Now())
Call MailDoc.Send(False)
End If