Tip

Set Cutoff Interval/Deletion Via LotusScript

Set the Automatic Replication Cutoff Interval and Deletion flag
programmatically via LotusScript.
Put this in the Declarations section:

Type DBREPLICAINFO
ID As Double
Flags As Integer
CutoffInterval As Integer
Cutoff As Double
End Type

Dim RepInfoStruct As DBREPLICAINFO

Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval
dbName As String, hdb As Long ) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hdb
As Long ) As Integer
Declare Function W32_NSFDbReplicaInfoGet Lib "nnotes.dll" Alias
"NSFDbReplicaInfoGet" ( Byval hdb As Long, replInfoStruct As DBREPLICAINFO ) As
Integer
Declare Function W32_NSFDbReplicaInfoSet Lib "nnotes.dll" Alias
"NSFDbReplicaInfoSet" ( Byval hdb As Long, replInfoStruct As DBREPLICAINFO ) As
Integer

Const REPLFLG_DISABLE% = &H0004 '*** Disable replication */
Const REPLFLG_IGNORE_DELETES% = &H0010 '*** Don't propagate deleted notes when
Const REPLFLG_CUTOFF_DELETE% = &H0080 '*** Auto-Delete documents prior to
cutoff date */

The Cutoff Interval function code:

Function SetCutoffInterval( TargetServer As String, TargetDb As String, NumDays
As Integer ) As Integer

'Function: SetCutoffInterval
'Details: Function is passed a target server, a target database and the
cutoff interval in days.
' Returns 1 if successful, 0 if not
'Author: Salvatore Messina
'Date: 10/25/99

Dim Tdb As String
Dim hdb As Long

'Build the path for target database.
If TargetServer$ = "" Then
Tdb$ = "MAIL"&TargetDb$
Else
Tdb$ = TargetServer$ & "!!" & TargetDb$
End If

status% = W32_NSFDbOpen( Tdb$, hdb& )
If status% <> 0 Then
Call W32_NSFDbClose ( hdb& )
Exit Function
End If

'Set the cutoff interval
RepInfoStruct.CutoffInterval=NumDays
status% = W32_NSFDbReplicaInfoSet( hdb&, RepInfoStruct)

'If call to API function went well, return 1, else 0
If status%=0 Then
SetCutoffInterval=1
Else
SetCutoffInterval=0
End If

Call W32_NSFDbClose ( hdb& )
End Function

The Cutoff Deletion function code:

Function SetCutoffDeletion( TargetServer As String, TargetDb As String, Switch
As Integer ) As Integer

'Function: SetCutoffDeletion
'Details: Function is passed a target server, a target database
' a 1 to enable Deletion of Documents past Cutoff Date or 0 to
disable.
' Returns 1 if successful, 0 if not
'Author: Salvatore Messina
'Date: 10/26/99

Dim Tdb As String
Dim hdb As Long

'Build the path for target database.
If TargetServer$ = "" Then
Tdb$ = "MAIL"&TargetDb$
Else
Tdb$ = TargetServer$ & "!!" & TargetDb$
End If

status% = W32_NSFDbOpen( Tdb$, hdb& )
'Could not open target database, return 0 and exit function
If status% <> 0 Then
Call W32_NSFDbClose ( hdb& )
SetCutoffDeletion=0
Exit Function
End If

status% = W32_NSFDbReplicaInfoGet( hdb&, RepInfoStruct)
'Could not get replication information, return 0 and exit function
If status%<>0 Then
SetCutoffDeletion=0
Else
'Get Binary representation of flags
BinFlags$=Bin$(RepInfoStruct.flags)
'If more than 8 bits returned in flags, some extended attributes set
'Extract the low order bits and get the first bit
If Len(BinFlags$)>8 Then
CutDel$=Left$(Rightbp$(BinFlags$,8),1)
Else
'Else just get the first bit
CutDel$=Left$(BinFlags$,1)
End If
'If the cutoff deletion option not enabled and function passed enable
flag, enable it.
If CutDel$<>"1" And Switch=1 Then<WHATLE

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.