Tip

Setting Database Warning Threshold

This function allows you to set a warning threshold for a database using
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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.