Lotus Notes API Error in loading DLL
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 tha开发者_如何学Ct 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.
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.
Yup, turns out there was a Notes patch applied to the dev environment (where all was working) that was not applied to the live environment.
精彩评论