[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4616
  • Last Modified:

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.
0
BooBoo2004
Asked:
BooBoo2004
1 Solution
 
sajuksCommented:
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 ?
 

0
 
BooBoo2004Author Commented:
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.
0
 
diasroshanCommented:
hi,

ur code seems to be right... guess some error with the software not being compatible...

my first guess would be some issues with redemption dll.

what i would suggest is uninstall the redemption dll and try the code...


let me know for more assistance...


Cheers,
Rosh
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now