LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: Enable Database Replication Schedule Property

Enable Database Replication Schedule Property (by Andrew Luke, 01/09/2007 06:11:45 AM)

Sorry, the code should be as follows;

------------CODE------------

Type TIMEDATE

   Innard1 As Long

   Innard2 As Long

End Type

Type DBREPLICAINFO

   ID As TIMEDATE

   flags As Integer

   CutoffInterval As Integer

   Cutoff As TIMEDATE

End Type

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, retReplicationInfo As DBREPLICAINFO) As Integer

Declare Function W32_NSFDbReplicaInfoSet Lib "nnotes.dll" Alias "NSFDbReplicaInfoSet"(Byval hDB As Long, retReplicationInfo As DBREPLICAINFO) As Integer

Declare Function W32_OSLockObject Lib "nnotes.dll" Alias "OSLockObject" ( Byval handle) As Long

Declare Sub OSUnlockObject Lib "NNOTES.DLL" Alias "OSUnlockObject" (Byval handle)

Declare Sub W32_OSMemFree Lib "NNOTES.DLL" Alias "OSMemFree" (Byval handle)

Class NotesReplicationSettings

   

   Private hDb As Long

   Private retReplicationInfo As DBREPLICAINFO

   Private prvdb As NotesDatabase

   Private flgDBExist As Integer

   

   Sub Delete

      If hDb <> 0 Then Call W32_NSFDbClose(hDb)

   End Sub

   

   Sub New (inpNotesDatabase As NotesDatabase)

      

      Dim sDatabase As String

      Dim uaesession As New notessession

      Dim rc As Integer

      

      Me.flgDBExist = False

      

      'Get a valid NotesDatabase to the specified database

      If inpNotesDatabase Is Nothing Then

         Error 14104, "NotesUserActivity: Database Object is invalid"

         Exit Sub

      End If

      

      Set prvdb = New NotesDatabase(inpNotesDatabase.Server, inpNotesDatabase.FilePath)

      

      If (prvdb.Server = "") Or (uaesession.IsOnServer) Then

         sdatabase = prvdb.filepath

      Else

         sdatabase = prvdb.server + "!!" + prvdb.filepath

      End If

      

      'Open the target database

      rc = W32_NSFDbOpen(sDatabase,Me.hDb)

      If rc <> 0 Then

         Me.flgDBExist = False

      End If

      

      'Set the Replica information

      rc = W32_NSFDbReplicaInfoGet(Me.hDb, Me.retReplicationInfo)

      If rc <> 0 Then

         Me.flgDBExist = False

      End If

      Me.flgDBExist = True

   End Sub

   

   Public Function DBExist As Integer

      DBExist = Me.flgDBExist

   End Function

   

   Public Function Parent As NotesDatabase

      Set Parent = prvdb

   End Function

   

   Public Function SetDisableReplica(sFlag As Integer) As Integer

      Dim puActivity As Long

      

      If Not Me.flgDBExist Then

         Error 14104, "Notes DB not opened"

         SetDisableReplica = False

         Exit Function

      End If

      

      Print Me.retReplicationInfo.flags

      

      'REPLFLG_DISABLE 0x0004 or &h4 (Temporarily disable replication)      

      Me.retReplicationInfo.flags = (Me.retReplicationInfo.flags Or Not &h4)

      

      rc = W32_NSFDbReplicaInfoSet(Me.hDb, Me.retReplicationInfo)

      If rc <> 0 Then

         Me.flgDBExist = False

      End If

      

   End Function

End Class