llewelm
asked on
Using Lotus Notes COM from PB 7.
Hello...I am attempting to make use of the Lotus Notes Lotus.NotesSession COM object from PB 7. Everything works fine under W2K with a Notes 5 client using the following code:
// create and connect to the session
lole_session = create oleobject
if (lole_session.connecttonew object("Lo tus.NotesS ession") < 0) then
messagebox("Mail Error", "Cannot connect to NOTES~rSending pre-defined e-mail aborted.", stopsign!)
return false
end if
// get the Notes password
if (len(gs_notes_password) = 0) then
if (open(w_notes_password, this) < 0) then
messagebox("Mail Error", "Unable to request the NOTES password~rSending pre-defined e-mail aborted.", stopsign!)
lole_session.disconnectobj ect()
destroy lole_session
return false
end if
// store the returned password
gs_notes_password = message.stringparm
// check for a Cancel button click
if (len(gs_notes_password) = 0) then
lole_session.disconnectobj ect()
destroy lole_session
return false
end if
end if
// initialize the Notes session
lole_session.initialize(gs _notes_pas sword)
// get the mail server and database
ls_server = lole_session.getenvironmen tstring("M ailServer" , true)
ls_database = lole_session.getenvironmen tstring("M ailFile", true)
// create and address the message
lole_database = lole_session.getdatabase(l s_server, ls_database)
lole_document = lole_database.createdocume nt()
lole_document.replaceitemv alue("From ", lole_session.username)
lole_document.replaceitemv alue("Subj ect", ps_subject)
lole_document.replaceitemv alue("Send To", ps_sendto)
lole_document.replaceitemv alue("Stat us", "")
// save the message to the Sent folder
lole_document.SaveMessageO nSend = true;
// create the message body field and fill it
lole_field = lole_document.createrichte xtitem("Bo dy")
lole_field.appendtext(ps_m essage)
lole_document.save(true, true)
// send the message
lole_document.send(false)
// disconnect from the OLE objects
lole_session.disconnectobj ect()
// destroy the OLE objects
destroy lole_session
The problem is that under Windows XP using an R6 client the code fails on the ConnectToNewObject line. I suspect that the "Lotus.NotesSession" reference is the issue, but I don't know what a suitable replacement would be.
I don't see either a Lotus.NotesSession or Domino.NotesSession reference in the Win XP registry under either \HKLM\SOFTWARE\Classes or \HKCR but I do under W2K.
Any help would be greatly appreciated.
// create and connect to the session
lole_session = create oleobject
if (lole_session.connecttonew
messagebox("Mail Error", "Cannot connect to NOTES~rSending pre-defined e-mail aborted.", stopsign!)
return false
end if
// get the Notes password
if (len(gs_notes_password) = 0) then
if (open(w_notes_password, this) < 0) then
messagebox("Mail Error", "Unable to request the NOTES password~rSending pre-defined e-mail aborted.", stopsign!)
lole_session.disconnectobj
destroy lole_session
return false
end if
// store the returned password
gs_notes_password = message.stringparm
// check for a Cancel button click
if (len(gs_notes_password) = 0) then
lole_session.disconnectobj
destroy lole_session
return false
end if
end if
// initialize the Notes session
lole_session.initialize(gs
// get the mail server and database
ls_server = lole_session.getenvironmen
ls_database = lole_session.getenvironmen
// create and address the message
lole_database = lole_session.getdatabase(l
lole_document = lole_database.createdocume
lole_document.replaceitemv
lole_document.replaceitemv
lole_document.replaceitemv
lole_document.replaceitemv
// save the message to the Sent folder
lole_document.SaveMessageO
// create the message body field and fill it
lole_field = lole_document.createrichte
lole_field.appendtext(ps_m
lole_document.save(true, true)
// send the message
lole_document.send(false)
// disconnect from the OLE objects
lole_session.disconnectobj
// destroy the OLE objects
destroy lole_session
The problem is that under Windows XP using an R6 client the code fails on the ConnectToNewObject line. I suspect that the "Lotus.NotesSession" reference is the issue, but I don't know what a suitable replacement would be.
I don't see either a Lotus.NotesSession or Domino.NotesSession reference in the Win XP registry under either \HKLM\SOFTWARE\Classes or \HKCR but I do under W2K.
Any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
One interesting thing though. I went back to our system folks to find out how the Notes 6 client was "created". They indicated that when upgrading our computers from W2K/R5 to Win XP/R6, the Notes 5 client was completely uninstalled and then the R6 client newly installed. They claimed not to be doing an upgrade.
Anyway, the problem seems to be resolved. Thanks...