Examples: ProtectReaders property (NotesView - LotusScript®)

This script toggles protection for the readers field.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim views As Variant
  Dim viewNameIn As String
  Set db = session.CurrentDatabase
  viewNameIn = Lcase(Inputbox("Name of view?"))
  views = db.Views
  Forall view In views
    If Lcase(view.Name) = viewNameIn Then
      If view.ProtectReaders Then
        view.ProtectReaders = False
        Messagebox "ProtectReaders is set for " _
        & view.Name
      Else
        view.ProtectReaders = True
        Messagebox "ProtectReaders is not set for " _
        & view.Name
      End If
      Exit Sub
    End If
  End Forall
  Messagebox "The view """ & viewNameIn & """ does not exist"
End Sub