例: NotesName class

  1. 次のエージェントは階層名を作成し、Common プロパティ、Abbreviated プロパティ、Canonical プロパティを表示します。
    Sub Initialize
      Dim session As New NotesSession
      Dim nam As NotesName
      Dim msg As String
      REM Create a hierarchical name
      Set nam = session.CreateName( _
      {CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US})
    %REM
    戻り値:John B Goode
      John B Goode/Sales/East/Acme/US
      CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US
    %END REM
      msg = nam.Common & Chr(13)
      msg = msg & nam.Abbreviated & Chr(13)
      msg = msg & nam.Canonical
      Messagebox msg,, "Canonical name"
    End Sub
  2. 次のエージェントはインターネットアドレスを作成し、Addr822Phrase プロパティ、Addr821 プロパティ、Addr822Comment1 プロパティ、Addr822Comment2 プロパティ、Addr822Comment3 プロパティを表示します。
    Sub Initialize
      Dim session As New NotesSession
      Dim nam As NotesName
      Dim msg As String
      REM Create an internet name
      Set nam = session.CreateName( _
      {"John B Goode" <jbg@us.acme.com> (Guitars) (Music) (East)})
    %REM
    戻り値:"John B Goode"
      jbg@us.acme.com
      Guitars
      音楽
      East
    %END REM
      msg = nam.Addr822Phrase & Chr(13)
      msg = msg & nam.Addr821 & Chr(13)
      msg = msg & nam.Addr822Comment1 & Chr(13)
      msg = msg & nam.Addr822Comment2 & Chr(13)
      msg = msg & nam.Addr822Comment3
      Messagebox msg,, "Internet name"
    End Sub
  3. 次のエージェントはユーザー名の Common プロパティ、Abbreviated プロパティ、Canonical プロパティを表示します。
    Sub Initialize
      Dim session As New NotesSession
      Dim nam As NotesName
      Dim msg As String
      REM Create a NotesName from user name
      Set nam = session.CreateName(session.UserName)
      REM Display common, abbreviated, and canonical formats
      msg = nam.Common & Chr(13)
      msg = msg & nam.Abbreviated & Chr(13)
      msg = msg & nam.Canonical
      Messagebox msg,, "User name"
    End Sub
  4. 次のエージェントは現在の文書 (メールメッセージ) の SendTo アイテムを取得し、Addr821 プロパティを表示します。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim nam As NotesName
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      Set doc = dc.GetFirstDocument
      REM Create NotesName from SendTo item
      REM We expect an Internet name
      Set nam = New NotesName(doc.GetItemValue("SendTo")(0))
      REM Display Addr821 name
      Messagebox nam.Addr821,, "SendTo name"
    End Sub