Local or Server mailfile - best way to determine

Further to my earlier post, about @MailDbName doesn’t work as described in the help - whats the best way of determining if the user is currently using the Local or Server mailfile?

@MailDbName is not an option, because it relies on the user actually being in the ‘right’ location document, chances are the user has not set that up properly, or just doesn’t use Location documents.

So how about, @Servername - like below:

t1:=@MailDbName;

t2:=@ServerName;

t3:=@UserName;

t4:=@If(t2=t3;“Local”;“Server”);

@Prompt([Ok];t1;t4)

Or is there another good way to tell that is not reliant on the location document? Where does @Servername get it’s details from?

Subject: Local or Server mailfile - best way to determine

You could check in the current db the attribute Server. When empty the user uses the local version.

dim session as New NotesSession

dim db as NotesDatabase

dim tserver as String

set db = session.CurrentDatabase

tserver = db.Server

Subject: RE: Local or Server mailfile - best way to determine

After some testing, it more complicated than I thought.As - this code is in a database. The database is always used locally on their PC…

But it’s used with their mailfile…so is there a way, for example, to tell not if the current database is used locally (always), but instead, from the local current database, then somehow go to there mailfile and workout if that is on local or not?

Subject: RE: Local or Server mailfile - best way to determine

I do not really understand what you are trying to say with “then somehow go to there mailfile and workout if that is on local or not?”.

It is no problem to open a db outside the current db. But where would you find the mailfile? In the person document you will find the location of the mailfile, but that will always be on a server. And when a user works on a local replica of his mailfile, it is replicated with the one on the server (otherwise there will be no mail delivered).

Could you shine some light on this?

Subject: RE: Local or Server mailfile - best way to determine

Of course.

Our user for example, is working on a disconnected setting in location document. Or, they are in any case not working in a disconnected mode in the location document, but, are working only locally. They are not connected to any network.

Then, the database I use can be used to import emails, into a different application. This application should work also when disconnected, as the other application is also working locally, like notes.

The application works with the users mailfile.

I am trying to determine, ideally, without using the location document, if the user is using their PC in this mode (disconnected from the network / using just a local mailfile).

The best I came up with is this:

FilePath:=@If(@MailDbName=“”;LocalPath;ServerPath);

e.g. @MailDbName apparently returns a “” if on local.

This function is OK. BUT - it does not do exactly as it says in the help, as IT USES THE LOCATION DOCUMENT to determine if it is local or not…unfortunately, this is like, predicating that our user will be uisng the location document as you or I would- but this is not neccessarily the case.

So I wondered if there was a better method, that does not make use of the location document, to determine whether the user is USING local notes, or server notes.

Subject: RE: Local or Server mailfile - best way to determine

Ok, it is clear now.

The only thing I can think of is to determine whether or not the server is accessible. You could do that by trying to open its names.nsf and see if it succeeds. When not the user is working locally. But the user could still be working locally AND the sever connection is available.

Subject: RE: Local or Server mailfile - best way to determine

Yeah…plus they might have a local replica of names.nsf.

So, I’ll stick with @MailDbName, and they will just have to work with the location document…