LotusScript. Just pass it a NotesDatabase object and a warning threshold (in
KB). The sample button code below shows how to set the warning threshold for
the current database to 980 KB:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim wthold&
wthold&=980
If SetWarningThreshold(session.CurrentDatabase, wthold&) Then
Msgbox "Function failed!", 48, "Demo"
Else
Msgbox "Warning threshold set to " & Cstr(wthold&) & " KB.", 0, "Demo"
End If
End Sub
' (Declarations)
Type DBQUOTAINFO
WarningThreshold As Long
SizeLimit As Long
CurrentDbSize As Long
MaxDbSize As Long
End Type
Declare Function OSPathNetConstruct Lib "nnotes" (Byval PortName As String,
Byval ServerName As String, Byval FileName As String, Byval retPathName As
String) As Integer
Declare Function NSFDbQuotaSetExt Lib "nnotes" (Byval Filename As String, Byval
Flags As Long, QuotaInfo As DBQUOTAINFO) As Integer
Const DBQUOTA_NOT_SPECIFIED = -1
Function SetWarningThreshold (db As NotesDatabase, wthold&) As Integer
Dim path$
Dim status%
Dim QuotaInfo As DBQUOTAINFO
path$=Space$(256)
' build API-friendly path to database
status%=OSPathNetConstruct("", db.Server, db.FilePath, path$)
If status%=0 Then
' fill in the DBQUOTAINFO structure
QuotaInfo.WarningThreshold = wthold& * 1024
QuotaInfo.SizeLimit = DBQUOTA_NOT_SPECIFIED
QuotaInfo.CurrentDbSize = DBQUOTA_NOT_SPECIFIED
QuotaInfo.MaxDbSize = DBQUOTA_NOT_SPECIFIED
' set the warning threshold for the db
status%=NSFDbQuotaSetExt(path$, 0, QuotaInfo)
End If
' return status of last API call
SetWarningThreshold=status%
End Function
This was first published in November 2000