views:

23

answers:

1

My client is using Lotus Notes 8.0.2. I am trying to use the following VBScript to call the Notes API to send an email:

dim objNotesSession, objNotesDatabase, objNotesItem, objNotesRichTextItem

set objNotesSession = CreateObject("Lotus.NotesSession")
Call objNotesSession.Initialize("[password here]")
set objNotesDatabase = objNotesSession.GETDATABASE("[server here]", "[path to NSF here]")
set objNotesDocument = objNotesDatabase.CreateDocument
set objNotesItem = objNotesDocument.ReplaceItemValue("Form", "Memo")
set objNotesItem = objNotesDocument.ReplaceItemValue("Subject", "My Test Subject")
set objNotesRichTextItem = objNotesDocument.CreateRichTextItem("Body")
objNotesRichTextItem.AppendText "This is the body"
objNotesRichTextItem.EmbedObject 1454, "", "[path to attachment here]"
objNotesDocument.Send False, "[to address here]"

[cleanup code here]

on the line Call objNotesSession.Initialize I get the following error: "Error in loading DLL: Initialize"

If I comment out that line, executing line "set objNotesDatabase = objNotesSession.GETDATABASE", then I get the error "Error in loading DLL: GETDATABASE"

Please can someone tell me why this is happening, and what I can do to resolve it?

Thanks, Shawn.

+1  A: 

The Initialize method is where you are logging in and really starting your Notes session. So if you comment out that line you aren't really connected to Notes and thus you can't get a handle to the database.

So back to the Initialize part... I'd first make sure everything is working well with your Notes client installation. You should be able to open Notes, login, and access the database you are intending to work with. Make sure the Notes directory and Data directory are in the PATH environment variable. Make sure you have enough rights to the Notes directories (perhaps grant Everyone full access to rule out issues).

Worst case, try reinstalling Notes or try running the script on another machine where Notes is working perfectly.

Ken Pespisa
Thanks Ken. The baffling thing is that the Lotus Notes client works 100% on that same machine. I will check the PATH environment variable and let you know.
Shawn de Wet
It definitely sounds like the notes DLL's cannot be found by your VBScript app.
Ed Schembor
ok Ed, but do you have any idea why that would be, how I solve that?
Shawn de Wet
seems the problem may have to do with the version of the nlsxbe.dll file (that is the entry point to the Notes API). We have a dev environment in which the above script is working fine, and there the version of this dll is 8.0.21.8357 while in the live environment (where we are experiencing this problem) the version is 8.0.20.8220. I've put the problem into IT's lap to ensure that the same version get's installed into Live. Will let you know
Shawn de Wet