Link to home
Start Free TrialLog in
Avatar of llewelm
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.connecttonewobject("Lotus.NotesSession") < 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.disconnectobject()
            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.disconnectobject()
            destroy lole_session
            return false
      end if
end if

// initialize the Notes session
lole_session.initialize(gs_notes_password)

// get the mail server and database
ls_server = lole_session.getenvironmentstring("MailServer", true)
ls_database = lole_session.getenvironmentstring("MailFile", true)

// create and address the message
lole_database = lole_session.getdatabase(ls_server, ls_database)
lole_document = lole_database.createdocument()
lole_document.replaceitemvalue("From", lole_session.username)
lole_document.replaceitemvalue("Subject", ps_subject)
lole_document.replaceitemvalue("SendTo", ps_sendto)
lole_document.replaceitemvalue("Status", "")

// save the message to the Sent folder
lole_document.SaveMessageOnSend = true;

// create the message body field and fill it
lole_field = lole_document.createrichtextitem("Body")
lole_field.appendtext(ps_message)
lole_document.save(true, true)
 
// send the message
lole_document.send(false)

// disconnect from the OLE objects
lole_session.disconnectobject()

// 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
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of llewelm
llewelm

ASKER

I performed the regsrv32 as was mentioned in the TechNote and the Lotus.NotesSession was added to the registry properly.  I was then able to run the application properly as I had under W2K/R5.

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...