Lisp HUG Maillist Archive

Strange COM-Error in LWW 5.0.2

Hi,

I try to control Microsoft Outlook via COM

The following VB6 Code creates a new mail and displays it:

  Dim Item As Outlook.MailItem
  Set Item = olk.CreateItem(olMailItem)
  Item.To = "andreas@atp-media.de"
  Item.Subject = "Testmail"
  Item.Display

My Lisp equivalent is:

(defmacro get-property (&rest args)
  `(com:invoke-dispatch-get-property ,@args))

(defmacro call (&rest args)
  `(com:invoke-dispatch-method ,@args))

(defun mail-with-error (to subject)
  (let* ((outlook (com:create-instance "Outlook.Application" :riid
'com:i-dispatch))
         (mail (call outlook "CreateItem" 0)))
    (setf (get-property mail "To") to)
    (setf (get-property mail "Subject") subject)
    (setf (get-property mail "Body") "This is the message.")
    (call mail "display")))

mail-with-error does exactly what it is supposed to do, but - additionally
throws the error:

CL-USER 30 > (mail-with-error "andreas@atp-media.de" "asdf")

Error: COM Error ((COM:I-DISPATCH COM:INVOKE)) : Unzulässige Funktion.

Display is executed - the new mail appears on the screen as expected!?

Is this a bug? Any ideas?


Thanks

Andreas


AW: Strange COM-Error in LWW 5.0.2

 

> ...
> I try to control Microsoft Outlook via COM
> ...
> mail-with-error does exactly what it is supposed to do, but - 
> additionally throws the error:
> 
> CL-USER 30 > (mail-with-error "andreas@atp-media.de" "asdf")
> 
> Error: COM Error ((COM:I-DISPATCH COM:INVOKE)) : Unzulässige Funktion.
> 
> Display is executed - the new mail appears on the screen as expected!?
> 
> Is this a bug? Any ideas?
> ...

Seems to be a Microsoft bug. After downgrading Outlook 2003 SP2 to Outlook
2003 w/o SP, everything is fine. Same function, same functionality, no
error!

Andreas


Updated at: 2020-12-10 08:45 UTC