?
Solved

Delphi: Connect to running MS Outlook

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Read this checklist to learn more about the 15 things you should never include in an email signature.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

743 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