Small script help. return the users home mail server in non-hiarchy format

I used the following to read the variable in notes.ini file

tempmailserver = session.GetEnvironmentString( “Mailserver”,True )

but it returns the name in HiArc… format, like CN=…

how can i just get the server name only? is there @name that can be used with scripting…

Subject: small script help. return the users home mail server in non-hiarchy format.

tempmailserver = session.GetEnvironmentString( “Mailserver”,True )Dim serverName as new NotesName(tempmailserver)

server = serverName.Common

'or, depending on what you want…

server = serverName.Abbreviated

Subject: thx a lot script master. :slight_smile:

Subject: :frowning: it does not work, please look at the code.

a simple code to return me the name of the server in commmon form, i can not get it to work. SCripting is getting on my nerves.notes.ini has a variable called Mailserver=CN=…

i like to get the common name and print it out using messagebox. could someone help me out plz?

Sub Click(Source As Button)

Dim session As New NotesSession

Dim serverName As New NotesName(tempmailserver)

tempmailserver = session.GetEnvironmentString( "Mailserver",True )

server = mailserver.Common





Messagebox(server)

End Sub

Subject: RE: :frowning: it does not work, please look at the code.

Please read about the NotesName class, which you can use to convert a canonical name into common name format.

Subject: RE: :frowning: it does not work, please look at the code.

You reversed the order of the statements that I posted. The “Dim serverName…” must come AFTER “tempmailserver=…”

You cannot establish serverName until after tempmailserver has a value.

By the way: I’m always nervous about extracting info from the notes.ini file. It may or may not be up to date. A better way to get the server name may be:

Dim tempmailserver As Variant

tempmailserver = Evaluate(“@MailDBName”)

tempmailserver will now be a Variant array with two values. tempmailserver(0) will be the server name and tempmailserver(1) will be the mail database path. You will still have to convert the name from canonical form to abbreviated or common form.