Page 2 of 2

Posted: Fri Apr 18, 2008 9:07 pm
by driessen
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,

Re: Problem with OLE and Outlook 2007

Posted: Wed Feb 02, 2011 4:46 pm
by Wanderson
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

Re: Problem with OLE and Outlook 2007

Posted: Thu Feb 03, 2011 12:48 pm
by driessen
Hello,

I use exactly the same code without having any problems.

But I noticed the you use

Code: Select all | Expand

oMail:Recipients:Add("myemail")
Maybe you should try a real e-mail address with a @ in it.

Good luck.

Re: Problem with OLE and Outlook 2007

Posted: Thu Feb 03, 2011 2:18 pm
by Wanderson
driessen wrote:Hello,

I use exactly the same code without having any problems.

But I noticed the you use

Code: Select all | Expand

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.

Re: Problem with OLE and Outlook 2007

Posted: Fri Feb 04, 2011 3:26 pm
by driessen
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

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.