imports domino
Module CreateReplica
Const NOTE_CLASS_NONE = 0
Const DBCOPY_REPLICA = 1
Dim hDb as integer
Public Function _
NSFDbCreateAndCopy( _
ByVal srcDb As String, ByVal dstDb As String, ByVal noteClass As Integer, ByVal limit As Integer, ByVal flags As Long, ByRef hDb As Integer) As Integer
End Function
Public Function CreateReplicaStubs(ByVal sourceserver As String, ByVal destinationserver As String, ByVal replicaId As String,byval password as string) As Boolean
Try
Dim session as Domino.NotesSession
Dim databaseke As NotesDatabase = Nothing
Dim dbDir As Domino.NotesDbDirectory
Dim SrcPath As String
Dim DestPath As String
Dim result As Integer
session = New Domino.NotesSession
session.Initialize(password)
dbDir = session.GetDbDirectory(sourceserver)
databaseke = dbDir.OpenDatabaseByReplicaID(replicaId)
If databaseke.IsOpen Then
SrcPath = sourceserver + "!!" + databaseke.FilePath
DestPath = destinationserver + "!!" + databaseke.FilePath
result = NSFDbCreateAndCopy(SrcPath, DestPath, NOTE_CLASS_NONE, 0, DBCOPY_REPLICA, hdb)
If result = 0 Then
Return True
Else
Return False
End If
else
Return false
End If
Catch ex As Exception
Msgbox("Error occured while creating replica stub on : " + destinationserver + vbCrLf + ex.ToString)
Return False
End Try
End Function
end module
|