Solved

Catching MS Outlook events

Posted on 2000-03-30
19
395 Views
Last Modified: 2010-04-04
I want to be able to capture MS Outlook events such as e-mail arrival, appointments, etc. using Delphi 5.  Does anyone have any links to good resources or components that I could look at?

BTW, I'm kinda new at Delphi, please keep that in mind...
 
Thanks,
Uy Hoang
0
Comment
Question by:uhoang
  • 7
  • 6
  • 3
  • +1
19 Comments
 
LVL 1

Expert Comment

by:snoop_doggy_dogg
ID: 2669796
Yeah dude!  You can use the EventSinkImp utility that ships with Delphi 5 to create a unit that will allow you to connect to Outlook (or any other automation server with events) from within your Delphi app or Delphi Add-in.

It's simple once you get the hang of it.

Woof!
http://www.woofwoofwoof.com
0
 

Author Comment

by:uhoang
ID: 2669876
Thanks.  Do you have any sample code or documentation that I could look at?
0
 
LVL 1

Expert Comment

by:snoop_doggy_dogg
ID: 2670111
Yes I do, but it'll have to wait until tonight.  I will post it when I get to my other office.

Woof!
http://www.woofwoofwoof.com
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
LVL 13

Expert Comment

by:Epsylon
ID: 2670156
Some demo's (including outlook) can be found here:

http://www.techvanguards.com/products/eventsinkimp/
0
 

Author Comment

by:uhoang
ID: 2670669
I used the EventSinkImp to create Sink Interfaces for the Microsoft Outlook 98 Object Model, but it gives me errors whenever I try to compile the OutlookEvents.pas file.  What gives?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2670842
It works just fine here....
0
 
LVL 1

Expert Comment

by:snoop_doggy_dogg
ID: 2671319
What are the errors?

Woof!
http://www.woofwoofwoof.com
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2671332
Did you install the component?
0
 
LVL 2

Expert Comment

by:florisb
ID: 2672461
that eventsink tool is made by Binh Ly. He moved his site to: http://www.intac.com/~bly/com/index.htm

I you have problems, try to contact him, he's very helpfull and knows much.

Floris.
0
 
LVL 2

Expert Comment

by:florisb
ID: 2672478
He, click on Eventsink there, and you'll see a downloadable demo for outlook98!?!?!

By the by, you can also do things yourself, I post some code that loops Outlook's folder's and add's events to all folders... ...some comments are in dutch

function TForm1.loopFoldersForEvents(MyNameSpace: olevariant;MyNameSpaceF: _Folders;diepte:integer): boolean;
//loop all folders (also depth), give them all eventhandler
var
  i,j : integer;
  MyNameCount, tempFolder,checkFolder : olevariant;
  tmpFolder: TOutlook9folders;
  tempMyNameSpaceF,F : _Folders;
begin
MyNameCount := MyNameSpace.Folders;
if MyNameCount.count > 0 then
  begin
//  tempMyNameSpaceF := MyNameSpaceF;
  for i := 1 to MyNameCount.Count do
    begin
    ///functie begint op root, item(i).folder -> 1 dieper.
    tempMyNameSpaceF := MyNameSpaceF.item(i).folders;
    tempFolder := MyNameSpace.Folders(i);
///event handlers:
     tmpFolder := TOutlook9folders.Create(Outlook9Application2);
     tmpFolder.ConnectTo(tempMyNameSpaceF);
     tmpFolder.OnFolderAdd := Outlook9Folders2FolderAdd;
     tmpFolder.OnFolderChange := Outlook9Folders2FolderChange;
     tmpFolder.OnFolderRemove := Outlook9Folders2FolderRemove;
//volgende regel zorgt ervoor dat add-event niet meer werkt, ook zonder @.
//     FolderList.add(@tmpFolder);
///....rest....
    checkFolder := tempFolder.Folders;
    ///roep als er subfolders zijn deze functie aan met deze subfolder
    if checkFolder.Count > 0 then
        begin
        loopFoldersForEvents(tempFolder,tempMyNameSpaceF,diepte+1);
        end;
    end;
  end;
result := true;
end;


event procedure like:
procedure TForm1.Outlook9Folders2FolderRemove(Sender: TObject);
begin
showMessage('folder removed');
end;

By the by; we had some problems detecting Outlook quit events. And for the Outlook start event, I implemented a hook.

Floris.




0
 
LVL 2

Expert Comment

by:florisb
ID: 2672502
epsylon, I see I posted a link you posted allready....;-(
0
 

Author Comment

by:uhoang
ID: 2673682
It's a ton of compilation errors.  I'm pretty new to Delphi.  I don't mind error checking my own code, but it's tough doing it on someone else's when you're just starting off.

Would you guys be willing for me to e-mail you the "OutlookEvents.pas" filing so you can take a look?
0
 

Author Comment

by:uhoang
ID: 2673697
In my last comment, I meant "file" not "filing" :)
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
ID: 2673926
Hi, why e-mail the "OutlookEvents.pas" file? I have it here already and it gives no errors.

I think you didn't install the "OutlookEvents.pas" as a component. To do that go to the Component menu > Install Component, browse for the "OutlookEvents.pas" file and click 'Ok'. When asked to rebuild, click 'Yes'.

Now you can load the demo project and compile...
0
 

Author Comment

by:uhoang
ID: 2674001
No, I did all that and I got a bunch of compiling errors.  Take a look:

http://www.wam.umd.edu/~uhoang/OutlookEventsErrors.txt
0
 

Author Comment

by:uhoang
ID: 2674205
No, I did all that and I got a bunch of compiling errors.  Take a look:

http://www.wam.umd.edu/~uhoang/OutlookEventsErrors.txt
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2681558
I have no idea why you get these errors.....
0
 

Author Comment

by:uhoang
ID: 2683764
I wrote to Binh Ly, the author, and was able to figure out that I had an older version.  I downloaded the newest one and was able to compile :)
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2684716
Does it answer your question?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 154
how can i search if string exist in array ? 3 63
Dynamically Created Query 3 62
Delphi: barcode reading on android platform 1 51
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

856 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