Solved

Delphi: Connect to running MS Outlook

Posted on 2016-11-11
4
204 Views
Last Modified: 2016-11-17
Hi,

Following code I use to connect with MS Outlook.
When trying to connect to a running instance of Outlook I get an EOleSysError:
NL: Uitvoeren vanaf de server is mislukt, ProgID: "outlook.application".
US: Server execution failed, ProgID: "outlook.application".  << translated
  try
    Outlook := GetActiveOleObject('outlook.application');  << ERROR
    Result     := True;
  except
    Outlook := CreateOleObject('outlook.application');    << THIS WORKS
    Result     := True;
  end;

Open in new window

Any ideas how to solve this?
0
Comment
Question by:Delphiwizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:xtermie
ID: 41885244
Can you check if everything matches and you've set up everything, like the outlook connection?
multiple instances of Outlook aren't allowed

const
  olMailItem = 0;
var
  Outlook: OLEVariant;
  MailItem: Variant;
  MailInspector : Variant;
  stringlist : TStringList;
begin
  try
   Outlook:=GetActiveOleObject('Outlook.Application') ;
  except
   Outlook:=CreateOleObject('Outlook.Application') ;
  end;

Open in new window


Also a similar case on EE
https://www.experts-exchange.com/questions/28933412/Can't-connect-to-Outlook-via-TOutlookApplication-component.html
0
 

Author Comment

by:Delphiwizard
ID: 41885329
@extermie:
Your code is the same as mine, so that isn't the problem.
The similar case you mentioned has a solution in case Outlook is still running in the background (in stead of being closed), but it doesn't solve the problem to connect to a running instance.
0
 
LVL 18

Accepted Solution

by:
xtermie earned 500 total points
ID: 41885386
0
 

Author Closing Comment

by:Delphiwizard
ID: 41891704
Thanks!
Your suggestion also pointed met to RapWare, which doesn't need a connection to Outlook itself.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question