Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to use Outlook Automation - Scaning Outlook's Folders Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
07-Jul-03
Category
OLE
Language
Delphi 5.x
Views
158
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Vladimir Orlenko

How I can information from Outlook in my application

Answer:

Sample how to work with Outlook from Delphi application 

1   unit UScanOutlook;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7     StdCtrls, Grids, Outline;
8   const
9     olByValue = 1;
10    olByReference = 4;
11    olEmbeddedItem = 5;
12    olOLE = 6;
13  
14    olMailItem = 0;
15    olAppointmentItem = 1;
16    olContactItem = 2;
17    olTaskItem = 3;
18    olJournalItem = 4;
19    olNoteItem = 5;
20    olPostItem = 6;
21  
22    olFolderDeletedItems = 3;
23    olFolderOutbox = 4;
24    olFolderSentMail = 5;
25    olFolderInbox = 6;
26    olFolderCalendar = 9;
27    olFolderContacts = 10;
28    olFolderJournal = 11;
29    olFolderNotes = 12;
30    olFolderTasks = 13;
31  
32  type
33    TForm1 = class(TForm)
34      oline_outlook: TOutline;
35      Button8: TButton;
36      procedure Button8Click(Sender: TObject);
37    private
38      { Private declarations }
39    public
40      { Public declarations }
41      OlApp, NameSpace, root: OleVariant;
42    end;
43  
44  var
45    Form1: TForm1;
46  
47  implementation
48  uses ComObj;
49  {$R *.DFM}
50  
51  procedure TForm1.Button8Click(Sender: TObject);
52    procedure scan(ol: TOutline; root: OleVariant; s: string);
53    var
54      i, j, k: integer;
55      bcount, rcount: integer;
56      branch, MAPIFolder: olevariant;
57      line: string;
58    begin
59      line := '';
60      rcount := root.count;
61      for i := 1 to rcount do
62      begin
63        line := s + root.item[i].name;
64        ol.Lines.Add(line);
65        branch := root.item[i].folders;
66        bcount := branch.count;
67        MAPIFolder := Namespace.GetFolderFromId(root.item[i].EntryID,
68          root.item[i].StoreID);
69        if MAPIFolder.Items.count > 0 then
70          for j := 1 to MAPIFolder.Items.count do
71            ol.Lines.Add(s + ' ' + MAPIFolder.Items[j].subject);
72        if bcount > 0 then
73        begin
74          scan(ol, branch, s + ' ');
75        end;
76      end;
77    end;
78  begin
79    oline_outlook.Lines.Clear;
80    OlApp := CreateOleObject('Outlook.Application');
81    Namespace := OlApp.GetNameSpace('MAPI');
82    root := Namespace.folders;
83    scan(oline_outlook, root, '');
84  end;
85  
86  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC