Creating a mail through COM (Visual Basic) starts Notes client with grey workspace (no database icons)

Hi

I created a Visual Basic Script that sends Notes mails through COM.

If the Notes client is not running it will be started automatically, but with an “empty” Workspace. No database icons are displayed unless I click on the corresponding bookmark.

The Workspace is set as default Home Page.

I found some postings here pointing to topics like Single Sign On (SSO) or to the “Don’t prompt for a password from other Notes-based programs” Preference. But this issue has nothing to do with them, I checked it out.

2 code examples below.

Any ideas are welcome.

Thanks in advance

Bodo

=========================================

Here are two different code examples, both producing the same effect:

Sub test01()

Dim SessionNotes As Object, NotesDB As Object, NotesDoc As Object

Dim strServer As String

Dim strMailFile As String

Set SessionNotes = CreateObject("Notes.NOTESSESSION")

'-- Read from notes.ini

strServer = SessionNotes.GetEnvironmentString("MailServer", True)

strMailFile = SessionNotes.GetEnvironmentString("MailFile", True)



Set NotesDB = SessionNotes.GetDatabase(strServer, strMailFile)



MsgBox NotesDB.Title & ": " & NotesDB.FilePath

End Sub


Sub test02()

Dim Notes_Session As New NotesSession

Notes_Session.Initialize

Dim strServer As String

strServer = Notes_Session.GetEnvironmentString(“MailServer”, True)

Dim Notes_Dir As NotesDbDirectory

Dim Notes_DB As NotesDatabase

Dim Notes_Doc As NotesDocument

Set Notes_Dir = Notes_Session.GetDbDirectory(strServer) '-- Domino-Server’s TCP/IPs Hostname

Set Notes_DB = Notes_Dir.OpenMailDatabase

MsgBox NotesDB.Title & ": " & Notes_DB.FilePath

End Sub

Subject: Creating a mail through COM (Visual Basic) starts Notes client with grey workspace (no database icons)

Well, let’s start with the fact that you’re not using COM, but the older OLE Automation classes. The COM interface is reached through “Lotus.NotesSession” rather than “Notes.NotesSession”. When you use COM, the Notes client will not start up in the UI.

Subject: RE: Creating a mail through COM (Visual Basic) starts Notes client with grey workspace (no database icons)

Thanks, Stan

So the code below works fine so far. But it is always asking for a pasword even if the Client is already running. Or I have to provide the password although SSO is enabled.

May I ask for anther hint?

======================

Sub test03()

Dim SessionNotes As Object, NotesDB As Object, NotesDoc As Object

Dim strServer As String

Dim strMailFile As String

Set SessionNotes = CreateObject("Lotus.NotesSession")

SessionNotes.Initialize

’ SessionNotes.Initialize (“Password”)

strServer = SessionNotes.GetEnvironmentString("MailServer", True)

strMailFile = SessionNotes.GetEnvironmentString("MailFile", True)

Set NotesDB = SessionNotes.GetDatabase(strServer, strMailFile)

MsgBox NotesDB.Title & ": " & NotesDB.FilePath

End Sub

Subject: RE: Creating a mail through COM (Visual Basic) starts Notes client with grey workspace (no database icons)

I have never used Notes with SSO, so I can’t help you there. It may require the Notes client to be active.