Examples: GetEnvironmentString method

  1. This script gets the value of the ENVLoc environment variable and puts it into the variable location. For example, GetEnvironmentString returns "15 Rogers Street" if the user's notes.ini (or Notes® Preferences) file contains the line $ENVLoc=15 Rogers Street.
    Dim session As New NotesSession
    Dim location As String
    location = session.GetEnvironmentString( "ENVLoc" )
  2. These two form scripts work together to get and set the environment variable ENVLoc. When a user composes a new document with the form, the value of ENVLoc gets placed into the Location field. When a user saves a document with the form, the contents of the Location field get saved to the environment variable ENVLoc. This means the user can compose several new documents without having to fill in the Location field each time.
    Sub Postopen(Source As Notesuidocument)
      Dim session As New NotesSession
      If source.IsNewDoc Then
        Call source.FieldSetText( "Location",  _
        session.GetEnvironmentString( "ENVLoc" ) )
      End If         
    End Sub
    Sub Querysave(Source As Notesuidocument, _
    Continue As Variant)
      Dim session As New NotesSession
      Call session.SetEnvironmentVar("ENVLoc", _
      source.FieldGetText("Location"))
    End Sub
  3. This script gets the value of the system environment variable MailServer. For example, GetEnvironmentString returns "London" if the notes.ini (or Notes® Preferences) file contains the line MailServer = London.
    Dim session As New NotesSession
    Dim server As String
    server = session.GetEnvironmentString("MailServer", True)