Page 1 of 1

Outlook 2013 , windows 8.1 Email (solved)

Posted: Thu Jul 03, 2014 10:13 am
by Richard Chidiak
Hello

I have a problem sending email with Outlook (office 2013) and windows 8.1

If outlook is active , i get an error , no way to send the mail

if outlook is not active, the code will execute without a problem.

Does anyone know a workaround ?

Code: Select all

TRY
  oOutlook = GetActiveObject( "Outlook.Application" )
//  MSGINFO("OUTLOOK EN EXECUTION")
 CATCH
  TRY
     oOutlook = CreateObject( "Outlook.Application" )
   CATCH
     msginfo("outlook can not be used")  // this is the message i get if outlook is active
   END
END

 

Re: Outlook 2013 , windows 8.1 Email

Posted: Thu Jul 03, 2014 12:09 pm
by hmpaquito
Richard,

More info about error:

Code: Select all

TRY
  oOutlook = GetActiveObject( "Outlook.Application" )
//  MSGINFO("OUTLOOK EN EXECUTION")
 CATCH
  TRY
     oOutlook = CreateObject( "Outlook.Application" )
   CATCH oErr
     msginfo(oErr:Operation+ CRLF+ oErr:Description, "outlook can not be used")  // this is the message i get if outlook is active
   END
END

Re: Outlook 2013 , windows 8.1 Email

Posted: Thu Jul 03, 2014 1:17 pm
by Richard Chidiak
This is what i get

toleauto:new

0x80080005

Antonio , any idea about this ?

Re: Outlook 2013 , windows 8.1 Email

Posted: Thu Jul 03, 2014 2:27 pm
by hmpaquito
Richard,

From http://blogs.msdn.com/b/adioltean/archi ... 32519.aspx

Try:

Code: Select all

FOR nIter:= 1 TO 3
   TRY
     oOutlook = GetActiveObject( "Outlook.Application" )
   //  MSGINFO("OUTLOOK EN EXECUTION")
    CATCH
     TRY
        oOutlook = CreateObject( "Outlook.Application" )
      CATCH oErr
//        msginfo(oErr:Operation+ CRLF+ oErr:Description, "outlook can not be used")  // this is the message i get if outlook is active
      END
   END
   IF oOutLook != NIL
       EXIT
   ENDIF
NEXT

IF oErr != nil
   msginfo(oErr:Operation+ CRLF+ oErr:Description, "outlook can not be used")  // this is the message i get if outlook is active
ENDIF

Re: Outlook 2013 , windows 8.1 Email

Posted: Thu Jul 03, 2014 2:29 pm
by driessen
This is the code I use :

Code: Select all

TRY
   GetActiveObject("Outlook.Application")
CATCH
   ShellExecute(,"Open","Outlook",,,3)
END
TRY
   oOutLook   := TOleAuto():New("Outlook.Application")
   oNameSpace := oOutlook:GetNameSpace("MAPI")
   EmSend     := .T.
CATCH
   EmSend     := .F.
END

IF EmSend
... my mail is send
I noticed that Outlook has to be started to be used. That's why I use the "ShellExcute".

I use this code since Office 2000 until now. So it works very well with Outlook 2000, XP (2002), 2003, 2007, 2010 and 2013.

But you need to change the settings in the trust center of Outlook : the "Programmatic access" has to be put to "Automatically approve". If not, the mail will not be send. To change this setting, you have to open Outlook with administrator rights.. So go to the folder Office15, right click on OUTLOOK.EXE and select "Open as administrator".

Good luck.

Outlook 2013 , windows 8.1 Email Solved

Posted: Fri Jul 04, 2014 4:11 am
by Richard Chidiak
Problem fixed the security setting did the trick

Thanks

Richard