Examples: NotesName class

  1. This agent creates a hierarchical name and displays its Common, Abbreviated, and Canonical properties.
    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
    Returns:
      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. This agent creates an Internet address and displays its Addr822Phrase, Addr821, Addr822Comment1, Addr822Comment2, and Addr822Comment3 properties.
    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
    Returns:
      "John B Goode"
      jbg@us.acme.com
      Guitars
      Music
      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. This agent displays the Common, Abbreviated, and Canonical properties of the user name.
    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. This agent gets the SendTo item of the current document, a mail message, and displays its Addr821 property.
    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