Earlier today Tim Tripcomy wrote a great article about Nexus, a new tool he has developed to allow databases to be assigned new replica ids. After reading the article I decided to finally get around to adding a Read/Write ReplicaID property to the .Domino Framework's DominoDatabase class based upon this code. (Thanks Tim, I remember seeing the breaking par code a long time ago and forgot where I had seen it). I will also be updating the Inspector tool included with the fraemwork so that the replicaid becomes editable. The code is as follows:-
'/**
' * Replica ID of database (NotesDatabase property is read-only)
' */
Property Get ReplicaID As String
If (iDB Is Nothing) Then Exit Property
ReplicaID$ = iDB.ReplicaID$
End Property
Property Set ReplicaID As String
Dim DB_Path As String*256
Dim hDB As Long
Dim ReplicaInfo As DBReplicaInfo
If (Len(ReplicaID$) < 16 Or Len(ReplicaID$) > 17) Then Exit Property ' ReplicaID must be 16 characters with optional ":" in the middle (as used by @formulae)
If iDB Is Nothing Then Exit Property
Call OSPathNetConstruct(0, iDB.Server$, iDB.FilePath$, DB_Path)
API_Return_Code = NSFDbOpen(DB_Path, hDb)
If (API_Return_Code <> 0) Then Exit Property
API_Return_Code = NSFDbReplicaInfoGet(hDb, ReplicaInfo)
If (API_Return_Code = 0) Then
ReplicaInfo.ReplicaID.Byte(0) = Val("&H"+Right(ReplicaID$,8))
ReplicaInfo.ReplicaID.Byte(1) = Val("&H" + Left(ReplicaID$,8))
API_Return_Code = NSFDbReplicaInfoSet(hDb, ReplicaInfo)
End If
API_Return_Code = NSFDbClose(hDb)
End Property