Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi: Connect to running MS Outlook

Posted on 2016-11-11
4
Medium Priority
?
401 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 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
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…

636 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