Set Cutoff Interval/Deletion Via LotusScript

Set the Automatic Replication Cutoff Interval and Deletion flag

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 last published in November 2000

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close