例: Views property (NotesReplicationEntry - LotusScript®)

次のエージェントは、複製エントリのビューをデータベースのすべてのビューに設定します。

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 Set views
  views$ = ""
  Forall v In db.Views
    views$ = views$ & v.Name & ";"
  End Forall
  re.Views = Left$(views$, Len(views$) - 1)
  Call re.Save
  
  REM Display views
  views$ = re.Views
  semi% = Instr(views$, ";")
  While semi% <> 0
    msg$ = msg$ & Left$(views$, semi% - 1) & Chr(13)
    views$ = Right$(views$, Len(views$) - semi%)
    semi% = Instr(views$, ";")
  Wend
  msg$ = msg$ & views$
  Messagebox msg$,, "Views for " & source$ & _
  " and " & destination$
End Sub