Retrieve and Update NOTES.INI Environment Values

The NOTES.INI file contains global environment settings used to manage the Lotus Notes client and associated databases.

How It Works

Using the GetEnvironmentString and SetEnvironmentString methods, you can obtain and set values stored in the NOTES.INI file. Both methods are associated with the NotesSession class. Retrieved values can be assigned, modified, and updated in the file. New environment names and values can also be created and appended to this file. You may want to do this to track a value that is specific to a particular database.

Implementation

The following example illustrates both the Get and Set methods. To manage values in NOTES.INI, first determine the variable name that you want to retrieve, modify, or insert into the file. The NOTES.INI file is typically stored in the /Notes directory. Next, adjust the following code to reference the variable name and insert the code into an action button (or other LotusScript event). You will need to update the variable name and uncomment the associated statements to try the Set method. You will also need to make a backup of the file prior to implementing code that updates this file.

Sub Click(Source As Button) Dim s As New NotesSession Dim theValue As String '---------------------------------------------------------------------- ' Get an environment value '---------------------------------------------------------------------- Set s = New NotesSession theValue = s.GetEnvironmentString("TimeZone", True) Msgbox "The current time zone value is: " & theValue '---------------------------------------------------------------------- ' Set an environment value '---------------------------------------------------------------------- ' theValue = "VALUE" ' Call s.SetEnvironmentVar("FIELD", theValue, True) End Sub

Категории