Manage Learn to apply best practices and optimize your operations.

Retrieve Database's Replication History

This LotusScript function allows you to programmatically retrieve a database's replication history, sorted by server name. This is the same list you see when you select "File - Replication - History" (and click "Server name") in the Notes R5 client.

This will only work in Win32 environments (WinNT, Win9x &LTa.k.a. "Wintendo">, etc.) as it makes calls to the Win32 API.

The button code below presents a sample of how to call this function, and also makes use of the OSLoadString API to determine the text of errors returned by Notes API calls. Read the comments in the sample code and the function code for further details:

Sub Click(Source As Button)
' This sample button calls the GetReplHistory function and displays a database's replication history
' sorted by server name in the format &LTserver> &LTfilename> &LTdate> &LTtime>
(&LTdirection>). For example:
' ServerA/CompanyX HRhris.nsf 08/01/2000 08:01:54 PM (Receive)
' ServerA/CompanyX HRhris.nsf 08/01/2000 02:32:12 PM (Send)
' If errors were encountered by the Notes API calls in GetReplHistory, the
' OSLoadString API is used to determine the error string returned.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim sList() As String
Dim nCt%, nReturn%
Dim lEntries&
Dim sMsg$, sBuffer$

Set db=session.GetDatabase("", "test.nsf")

' retrieve the history sorted by server name
nReturn%=GetReplHistory(db, sList, lEntries&)

If nReturn% = 0 Then
' no errors--build a string to show in a msgbox
sMsg$=""
For nCt%=0 To lEntries&-1
sMsg$=sMsg$ & sList(nCt%) & Chr(13) & Chr(10)
Next

' show the string
Msgbox sMsg$, 0, "Replication History for " & db.Title

Elseif nReturn=ERR_SPECIAL_ID Then
' no history found
Msgbox "There is no replication history for this database.", 32, "Replication History"

Else
' find out what the error string is from the API
sBuffer$=String$(256, 0)
OSLoadString 0, nReturn%, sBuffer$, 255

' errors found
Msgbox "Error found in retrieving history: " & sBuffer$, 48, "Replication History Error"
End If
End Sub

' Notes API constants
Const DIRECTION_NEVER=0
Const DIRECTION_SEND=1
Const DIRECTION_RECEIVE=2
Const MAXPATH=256
Const MAXALPHATIMEDATE=80
Const ERR_SPECIAL_ID=578

' custom type for storing individual replication history entries
Type HIST_ENTRY
RepTime As String
ServerName As String
FileName As String
Direction As String
End Type

' Notes API types (based on C structs)
Type TIMEDATE
Innards1 As Long
Innards2 As Long
End Type

Type REPLHIST_SUMMARY
ReplicationTime As TIMEDATE
AccessLevel As Integer
AccessFlags As Integer
Direction As Integer
ServerNameOffset As Long
ServerNameLength As Integer
FileNameLength As Integer
Spare1 As Long
Spare2 As Long
End Type


Dig Deeper on Lotus Notes Domino Administration Tools

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

I can´t make it work, do you know why.
Can you export to excel or notepad?
Cancel

-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 ...

SearchDataCenter

SearchContentManagement

Close