Articles   Members Online:
-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 work with Lotus Notes via OleAuto 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 3.x
Views
182
User Rating
8
# Votes
1
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Vladimir Orlenko

How work with LotusNotes via OleAuto

Answer:

1   unit Unit2;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7     Dialogs, Domino_TLB, Menus, ComCtrls;
8   const
9     PASSWD = 'ur70';
10  type
11    TForm2 = class(TForm)
12      TV_INFO: TTreeView;
13      MainMenu1: TMainMenu;
14      File1: TMenuItem;
15      Create1: TMenuItem;
16      Init1: TMenuItem;
17      AddressBook1: TMenuItem;
18      Scan1: TMenuItem;
19      procedure Create1Click(Sender: TObject);
20      procedure Init1Click(Sender: TObject);
21      procedure Scan1Click(Sender: TObject);
22    private
23      { Private declarations }
24    public
25      { Public declarations }
26    end;
27  
28  var
29    Form2: TForm2;
30    Session: TNotesSession;
31  implementation
32  
33  {$R *.dfm}
34  
35  procedure TForm2.Create1Click(Sender: TObject);
36  begin
37    Session := TNotesSession.Create(nil);
38  end;
39  
40  procedure TForm2.Init1Click(Sender: TObject);
41  begin
42    Session.Initialize(PASSWD);
43  end;
44  
45  procedure TForm2.Scan1Click(Sender: TObject);
46  var
47    NotesDb: NotesDatabase;
48    addrBook: NotesDatabase;
49    People, People2: NotesView;
50    Person, Person2: NotesDocument;
51    View: NotesView;
52    Item: NotesItem;
53    AddrBooks: OleVariant;
54    Views: OleVariant;
55    Items: OleVariant;
56    x, y, z: integer;
57    view_name: string;
58    tn, tc: TTreeNode;
59  begin
60    NotesDb := Session.GetDatabase('', 'names.nsf', False);
61    AddrBooks := Session.AddressBooks;
62    for x := 0 to VarArrayHighBound(AddrBooks, 1) -
63      VarArrayLowBound(AddrBooks, 1) do
64    begin
65      addrBook := NotesDatabase(IUnknown(AddrBooks[x]));
66      if (addrBook.IsPrivateAddressBook) then
67      begin
68        addrBook.Open;
69      end
70      else
71        addrBook := nil;
72      if (addrBook <> nil) then
73      begin
74        Views := addrBook.Views;
75        for y := 0 to VarArrayHighBound(Views, 1) -
76          VarArrayLowBound(Views, 1) do
77        begin
78          View := NotesView(IUnknown(Views[y]));
79          view_name := View.Name;
80          tn := tv_info.Items.AddNode(nil, nil, view_name, nil, naAdd);
81  
82          if copy(view_name, 1, 1) = '$' then
83            view_name := copy(view_name, 2, length(view_name) - 1);
84          people := addrBook.GetView(view_name);
85          person := people.GetFirstDocument;
86          if Person <> nil then
87          begin
88            Items := Person.Items;
89            for z := 0 to VarArrayHighBound(Items, 1) -
90              VarArrayLowBound(Items, 1) do
91            begin
92              Item := NotesItem(IUnknown(Items[z]));
93              tc := tv_info.Items.AddChild(tn, Item.Name);
94  
95              people := addrBook.GetView(view_name);
96              person := people.GetFirstDocument;
97  
98              while (Person <> nil) do
99              begin
100               try
101                 try
102                   tv_info.Items.AddChild(tc, Person.GetFirstItem(Item.Name).Text
103                     {Item.Text});
104                 except
105                 end;
106               finally
107                 Person := People.GetNextDocument(Person);
108               end;
109             end;
110           end;
111         end;
112       end;
113 
114     end;
115   end;
116 end;
117 
118 end.


you can get type library info on 

ftp://ftp.lotus.com/pub/lotusweb/devtools/comdoc.chm 
ftp://ftp.lotus.com/pub/lotusweb/devtools/comdoc.chm 

it work IMHO only for LotusNotes Domino ver 5 or highe

			
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