Call V_SESSION.Initialize

Hi My client has many users of Lotus Notes all users have varying access rights on their pc’s.

My application connects to Lotus Notes prompting the user for their user name and Password. Using the Call V_SESSION.Initialize

command.

The problem is that on some machines the Call V_SESSION.Initialize fails with no visible error. It just fails to prompt the user for their details. On other machines it works fine.

The only common ground I could find was that the machines it did work on the user had been initially set up with Administrator rights on their local pc.

I tried giving the other users where the link failed the rights of administrator but this still failed.

I cannot think what the problem could be I wrote a very simple .EXE to prove that it was not my application and this fails as well so it must be something to do with access rights and the Lotus COM object.

Can anyone help?

Option Explicit

'Ininitialize the notes com interface

Public V_SESSION As New NotesSession

'various com-handles required to open the inbox folder

Dim V_VIEW As NotesView

Dim V_DATABASE As NotesDatabase

Dim V_DOCUMENT As NotesDocument

Dim V_DOC_COLLECTION As NotesDocumentCollection

Dim V_ADDRESS_VIEW As NotesView

Dim V_ADDRESS_BOOKS As Variant

Dim V_NOTES_DELIM As String

Private Sub Command1_Click()

Dim strCurrentPath As String

MsgBox “Start Connection”

Dim L_STRING As String

Dim L_MAIL_SERVER As String

Dim L_MAIL_FILE As String

Dim L_MAIL_TYPE As String

On Error GoTo ErrorHandler

MsgBox “Initialise Session”

'This will prompt the user to enter their password

Call V_SESSION.Initialize

'Did something go wrong with the login

If (V_SESSION Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

MsgBox “Session Initialised”

'connect to the notes database

Set V_DATABASE = V_SESSION.GetDatabase(“”, “NAMES.NSF”)

'Did something go wrong with the connection to the database

If (V_DATABASE Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

Set V_VIEW = V_DATABASE.GetView(“Locations”)

'Did something go wrong whilst switching to the relevant view

If (V_VIEW Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

'Determine where the users notes store is located

L_STRING = V_SESSION.GetEnvironmentString(“Location”, True)

L_STRING = Left(L_STRING, InStr(L_STRING, “,”) - 1)

Set V_DOC_COLLECTION = V_VIEW.GetAllDocumentsByKey(L_STRING)

'Did something go wrong whilst retrieving the collection of documents from the view

If (V_DOC_COLLECTION Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

Set V_DOCUMENT = V_DOC_COLLECTION.GetFirstDocument

'Did something go wrong whilst retrieving the first document from the document collection

If (V_DOCUMENT Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

'This returns the server connection details for the notes store

L_MAIL_SERVER = V_DOCUMENT.GetItemValue(“MailServer”)(0)

L_MAIL_FILE = V_DOCUMENT.GetItemValue(“MailFile”)(0)

L_MAIL_TYPE = V_DOCUMENT.GetItemValue(“MailType”)(0)

'Reset the objects

Set V_DOCUMENT = Nothing

Set V_DOC_COLLECTION = Nothing

Set V_DATABASE = Nothing

'Open the user’s personal mail database

Set V_DATABASE = V_SESSION.GetDatabase(IIf(L_MAIL_TYPE = “0”, L_MAIL_SERVER, “”), L_MAIL_FILE)

'Did something go wrong with the connection to the database

If (V_DATABASE Is Nothing Or Err <> 0) Then

GoTo ErrorHandler

End If

V_ADDRESS_BOOKS = V_SESSION.AddressBooks

'Did something go wrong with accessing the address books

If (Err <> 0) Then

GoTo ErrorHandler

End If

GoTo clear

ErrorHandler:

'Reset all the objects

MsgBox “Error:” + Err.Description

Set V_DOCUMENT = Nothing

Set V_DOC_COLLECTION = Nothing

Set V_VIEW = Nothing

Set V_DATABASE = Nothing

Set V_SESSION = Nothing

Set V_ADDRESS_VIEW = Nothing

Set V_ADDRESS_BOOKS = Nothing

Err = 0

clear:

MsgBox “Program End”

End Sub