Outlook 2013 , windows 8.1 Email (solved)

Post Reply
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Outlook 2013 , windows 8.1 Email (solved)

Post 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

 
Last edited by Richard Chidiak on Fri Jul 04, 2014 1:52 pm, edited 1 time in total.
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Outlook 2013 , windows 8.1 Email

Post 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
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Outlook 2013 , windows 8.1 Email

Post by Richard Chidiak »

This is what i get

toleauto:new

0x80080005

Antonio , any idea about this ?
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Outlook 2013 , windows 8.1 Email

Post 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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Outlook 2013 , windows 8.1 Email

Post 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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Outlook 2013 , windows 8.1 Email Solved

Post by Richard Chidiak »

Problem fixed the security setting did the trick

Thanks

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Post Reply