Problem with OLE and Outlook 2007

Postby driessen » Fri Apr 18, 2008 9:07 pm

Hello guys,

There is a much easier solution to get arround this problem with Outlook.

You can download it free at : www.mapilab.com/outlook/security

It works with all Outlook versions.

Regards,
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with OLE and Outlook 2007

Postby Wanderson » Wed Feb 02, 2011 4:46 pm

Hi, anyone have a solution about this error?

I have try:

oOutLook := CreateObject("Outlook.Application")
oNameSpace := oOutlook:GetNameSpace("MAPI")
oMail := oOutLook:CreateItem(0)
oMail:Subject := "test"
oMail:Body := "test"
oMail:Recipients:Add("myemail")
oMail:CC := ""
oMail:BCC := ""
oMail:Send()

and:

oOutLook := CreateObject("Outlook.Application")
oNameSpace := oOutlook:GetNameSpace("MAPI")
oMail := oOutLook:CreateItem(0)
oMail:Subject := "test"
oMail:Body := "test"
oMail:To := "myemail"
oMail:CC := ""
oMail:BCC := ""
oMail:Send()

and both gives the error: Error description: Error Outlook.Application:CREATEITEM/0 S_OK: RECIPIENTS

If i open outlook 2007 first thats ok. Any idea? Thanks in advance.

Wanderson
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Problem with OLE and Outlook 2007

Postby driessen » Thu Feb 03, 2011 12:48 pm

Hello,

I use exactly the same code without having any problems.

But I noticed the you use
Code: Select all  Expand view
oMail:Recipients:Add("myemail")
Maybe you should try a real e-mail address with a @ in it.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with OLE and Outlook 2007

Postby Wanderson » Thu Feb 03, 2011 2:18 pm

driessen wrote:Hello,

I use exactly the same code without having any problems.

But I noticed the you use
Code: Select all  Expand view
oMail:Recipients:Add("myemail")
Maybe you should try a real e-mail address with a @ in it.

Good luck.


Hello driessen, "myemail" its just a exemple i have using a real email in this case, but if outlook2007 is not open show the error reported, what your fwh version?

Thanks in advance.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Problem with OLE and Outlook 2007

Postby driessen » Fri Feb 04, 2011 3:26 pm

Hello,

Sorry but I think I didn't understand your question very well.

This is the code I use to make a connection to Outlook to avoid the error you mentioned :
Code: Select all  Expand view
LOCAL cTasks

LOCAL OutlFound := .F.

cTasks := GetTasks()
FOR i=1 TO LEN(cTasks)
    IF AT("OUTLOOK",UPPER(cTasks[i])) <> 0
       OutlFound := .T.
       i := LEN(cTasks)
    ENDIF
NEXT
IF !OutlFound ; ShellExecute(,"Open","Outlook",,,3) ; ENDIF

TRY
   oOutLook   := CreateObject("Outlook.Application")
   oNameSpace := oOutlook:GetNameSpace("MAPI")
   EmSend     := .T.
CATCH
   TRY
      oOutLook   := CreateObject("Outlook.Application")
      oNameSpace := oOutlook:GetNameSpace("MAPI")
      EmSend     := .T.
   CATCH
      EmSend   := .F.
   END
END

IF EmSend

    // Your source to send your mail

ENDIF
 
Hope this can help you. It runs fine in my application.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests