例: AddressBooks property

  1. 次のスクリプトは各アドレス帳を取得します。スクリプトはアドレス帳を開いて、ダイアログボックスにそのタイトルを表示します。
    Dim session As New NotesSession
    Dim books As Variant
    books = session.AddressBooks
    Forall b In books
      Call b.Open( "", "" )
      Messagebox( b.Title )
    End Forall
  2. 次のスクリプトは、アドレス帳を参照して従業員の電話番号を検索します。従業員のラストネームが入力されると、スクリプトは使用可能なすべての Domino ディレクトリの [ユーザー] ビューでその名前を検索します。名前と一致するユーザー文書が検索されると、スクリプトはユーザーの電話番号をユーザー文書の OfficePhoneNumber アイテムから取得して表示します。一致するユーザー文書がどの Domino ディレクトリにもないとき、スクリプトはエラーメッセージを表示します。
Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim books As Variant
  Dim view As NotesView
  Dim doc As NotesDocument
  Dim done As Variant
  Dim person As String
  books = session.AddressBooks
  done = False
  person = Inputbox$ _
  ( "Enter the last name of the person: ", "Last name" )
  Forall b In books
    ' check every Domino Directory,
    ' unless we're already done
    If ( b.IsPublicAddressBook ) And ( Not done ) Then
      Call b.Open( "", "" )
      ' look up person's last name
      ' in People view of address book
      Set view = b.GetView( "People" )
      Set doc = view.GetDocumentByKey( person )
      ' if person is found, display the phone number item 
      ' from the Person document
      If Not ( doc Is Nothing ) Then
        Messagebox( "Phone for " + person  _
        + " is " + doc.OfficePhoneNumber( 0 ) )
        done = True
      End If
    End If
  End Forall
  ' if done is still False, the person wasn't found
  If Not done Then
    Messagebox _
    ( "Sorry, unable to locate person's name." )
  End If
End Sub