Link to home
Start Free TrialLog in
Avatar of BooBoo2004
BooBoo2004

asked on

oleobject.ConnectToNewObject("Outlook.Application") fails with a -3 return code

I am using the Outlook Redemption dll for my email application.  When I try to connect via the ConnectToNewObject("Outlook.Application"), I get a -3 return code.  I guess that this means that the object could not be created.  The code that I am using is:

      oleOutlook = create oleobject
      rc = oleOutlook.ConnectToNewObject("outlook.application")
      
      If rc = 0 Then
            oleNameSpace = oleOutlook.GetNameSpace("MAPI")
            oleNameSpace.Logon("", "", true, true)

            oleSafeMailItem = create oleobject
            rc = oleSafeMailItem.ConnectToNewObject("Redemption.SafeMailItem")

            If rc = 0 Then
                  oleTmp = create oleobject
                  oleTmp = oleOutlook.CreateItem(0)
                  oleSafeMailItem.Item = oleTmp
                  oleSafeMailItem.Recipients.Add(ls_sendto)
                  oleSafeMailItem.Recipients.ResolveAll
                  oleSafeMailItem.Subject = ls_subject
                  oleSafeMailItem.Send

            Else
                  MessageBox("Mail Error", &
                           "Your email could not be sent.  Please contact IT.~r~n" + &
                           "The SafeMailItem  - ConnectToNewObject~r~n" + &
                           "failed with a return code of " + String(rc) + ".", &
                           StopSign!, &
                           Ok!)
            End If
      Else
            MessageBox("Mail Error", &
                     "Your email could not be sent.  Please contact IT.~r~n" + &
                     "The Outlook Application  - ConnectToNewObject~r~n" + &
                     "failed with a return code of " + String(rc) + ".", &
                     StopSign!, &
                     Ok!)
      End If

If I change the Outlook.Application with Word.Application, the connecttonewobject works fine.  I think that this may be a registry problem.  When I compare Outlook.Application to the Word.Application registry values, I do not see the key VersionIndependentProgID for Outlook.  I added it, but it still did not work.  I would like to get this fixed ASAP.

I am using PB10, Windows 2000, Outlook 2003 (Mail server is Exchange), and the latest Redemption dll.
Avatar of sajuks
sajuks

what is the return code if you use outlook.application.11 instead of outlook.application
     rc = oleOutlook.ConnectToNewObject("outlook.application.11")

you could've if
   if connecttonewobject(outlook.application) failure then
        connecttonewobject(outlook.application.11)
. I tested your code its working. Did you try this in some other machine ?
 

Avatar of BooBoo2004

ASKER

I changed it to outlook.application.11 and still get the same error.  I have not tried it on another machine as I am the only developer here.
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

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