My users frequently complain that their e-mails are delayed. They also complain that they receive a "New mail warning," but e-mails don't appear in their inboxes until an hour later. This is because they were using their "Local mail file" even though their location is "Office."
I solved the problem by restricting my users to two different Locationdoc's: "Office" and "Travel." I know that "Office" is the wrong when using Mailfile on Local( db.Server is "blank" ).
Sub Postopen(Source As Notesuidatabase)
' ******* Test for local mail file - Begin ********
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim loca As String
Dim comma As String
Dim lname As String
If ( db.Server = "" ) Then
loca = session.GetEnvironmentString
( "Location", True )
comma = Instr ( loca , "," )
lname = Left ( loca, comma -1)
If lname = "Office" Then
Messagebox "
You are now using your LOCALE mailfile" ,
MB_ICONEXCLAMATION, "
******* WARNING ********* "
Else
End If
Else
End If
' ******* Test for local mail file - End ********
End Sub
I know that not all Administrators are allowed the luxury of restricting their users to two locations. So here is some extended code to check the actual value in the location used.
Sub Postopen(Source As Notesuidatabase)
' ******* Test for local mail file ********
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim lok As String
Dim komma As String
Dim lname As String
' ** Server = _blank then file is on local,
so now find name on Location used
If ( db.Server = "" ) Then
lok = session.GetEnvironmentString
( "Location", True )
komma = Instr ( lok , "," )
lname = Left ( lok, komma -1)
' ** The Find path to local mail file
Dim sTemp As String, sNab As String
Dim view As NotesView
'** Get and parse the
NAB setting stored in INI file
sTemp =
session.GetEnvironmentString("NAMES", True)
' ** Allow for the possibility
of multiple NABs being specified
- if so, take only the first one
If Instr(sTemp, ",") Then
sNab = Trim(Strleft(sTemp, ","))
End If
If Instr(sTemp, ";") Then
sNab = Trim(Strleft(sTemp, ";"))
End If
' ** Get only Names.nsf
If sNab = "" Then
sNab = "Names.nsf"
End If
Set db = New NotesDatabase("",sNab)
Set view = db.GetView("Locations")
' ** Now get "Mail file location"
[Field=MailType ( on Server=0 Local=1 ) ]
Dim doc As NotesDocument
Set doc = view.Getdocumentbykey (lname)
If Not (doc Is Nothing) Then
If doc.GetItemValue( "MailType" )
(0) = "0" Then
' Messagebox " Mail-type "
& doc.GetItemValue( "MailType" ) (0)
Messagebox
"You are now using
your LOCALE mailfile" , MB_ICONEXCLAMATION,
"******* Warning *********"
Else
End If
Else
End If
Else
End If
' ******* Test for local mail file ********
End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Peder Koed. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.