OLE

OLE
With this code:
      try
        Outlook := GetActiveOleObject( 'Outlook.Application' );
      except
        Outlook := CreateOleObject( 'Outlook.Application' );
      end;

The GetActiveOleObject works if Outlook is running.  However, the CreateOleObject does not work if Outlook is not running. Google just points me to dozens of samples using this same snippet. What am I missing?

Comments

  1. Ah, but in trying to use the TOutlookApplication component on the form, I still have a problem. With or without Coinitialize (which I would not think I need, with the component), it will not open Outlook if it is not already running.

    ReplyDelete
  2. Hmm.... Would it be possible to launch Outlook through a shell command first?

    ReplyDelete
  3. Lars Fosdal Where I ended up was back at MAPI. I get support for TO:, CC:, and attachments, with plain text in the body. It opens an Outlook edit window, and they can format text there, if they wish, before sending.

    With OLE, there were numerous issues, and the worst was that it appears to be counter to MS Security plans for an app to communicate with Outlook. When that happens, Outlook opens a dialog asking for permission, and the longest interval it will accept there is 10 minutes. There may be a way to resolve that issue, but I needed to send email, not create another science project.

    ReplyDelete

Post a Comment