例: NotesReplicationEntry class

  1. 次のエージェントは、複製エントリを取得し、そのプロパティを表示します。
    Sub Initialize
      REM Get local database
      dbName$ = _
      Inputbox$("Database name", _
      "Enter name of local database")
      Dim db As New NotesDatabase("", dbName$)
      Dim rep As NotesReplication
      Dim re As NotesReplicationEntry
      If Not db.IsOpen Then
        Messagebox "No local database",, dbName$
        Exit Sub
      End If
      
      REM Get source and destination computers
      source$ = _
      Inputbox$("Source", _
      "Enter name of source computer")
      If Instr(1, source$, "Any Server", 5) > 0 Then
        source$ = "-"
      End If
      destination$ = _
      Inputbox$("Destination", _
      "Enter name of destination computer")
      If Instr(1, destination$, "Any Server", 5) > 0 Then
        destination$ = "-"
      End If
      
      REM Get replication entry
      Set rep = db.ReplicationInfo
      Set re = rep.GetEntry(source$, destination$, False)
      If re Is Nothing Then
        Messagebox _
        "No replication entry for " & source$ & _
        " and " & destination$,, _
        "No such replication entry"
        Exit Sub
      End If
      
      REM Display properties
      msg$ = "Source: " & re.Source & Chr(13) & _
      "Destination: " & re.Destination & Chr(13) & _
      "Formula: " & re.Formula & Chr(13) & _
      "Views: " & re.Views & Chr(13) & _
      "IsIncludeACL: " & re.IsIncludeACL & Chr(13) & _
      "IsIncludeAgents: " & re.IsIncludeAgents & Chr(13) & _
      "IsIncludeDocuments: " & _
      re.IsIncludeDocuments & Chr(13) & _
      "IsIncludeForms: " & re.IsIncludeForms & Chr(13) & _
      "IsIncludeFormulas: " & re.IsIncludeFormulas
      Messagebox msg$,, "Replication entry"
    End Sub
  2. 次のエージェントは、複製エントリを作成します。
    Sub Initialize
      REM Get local database
      dbName$ = _
      Inputbox$("Database name", _
      "Enter name of local database")
      Dim db As New NotesDatabase("", dbName$)
      Dim rep As NotesReplication
      Dim re As NotesReplicationEntry
      If Not db.IsOpen Then
        Messagebox "No local database",, dbName$
        Exit Sub
      End If
      
      REM Attempt to get replication entry for Any-Any
      Set rep = db.ReplicationInfo
      Set re = rep.GetEntry("-", "-", False)
      
      REM Create an entry if it does not already exist
      If re Is Nothing Then
        Set re = rep.GetEntry("-", "-", True)
        re.IsIncludeACL = False
        Call re.Save
      Else
        Messagebox "Any-to-any already exists",, _
        "Entry already exists"
      End If
    End Sub