FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Outlook 2013 , windows 8.1 Email (solved)
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Outlook 2013 , windows 8.1 Email (solved)
Posted: Thu Jul 03, 2014 10:13 AM
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 (fw): Select all Collapse
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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Outlook 2013 , windows 8.1 Email
Posted: Thu Jul 03, 2014 12:09 PM
Richard,

More info about error:

Code (fw): Select all Collapse
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
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Outlook 2013 , windows 8.1 Email
Posted: Thu Jul 03, 2014 01:17 PM

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
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Outlook 2013 , windows 8.1 Email
Posted: Thu Jul 03, 2014 02:27 PM
Richard,

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

Try:

Code (fw): Select all Collapse
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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Outlook 2013 , windows 8.1 Email
Posted: Thu Jul 03, 2014 02:29 PM
This is the code I use :
Code (fw): Select all Collapse
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Outlook 2013 , windows 8.1 Email Solved
Posted: Fri Jul 04, 2014 04:11 AM

Problem fixed the security setting did the trick

Thanks

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013

Continue the discussion