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
Retrieving names, addresses, e-mails from MS Outlook 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
24-Aug-02
Category
OLE
Language
Delphi 2.x
Views
83
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

So how to read a collection of Contacts which are exist in MS Outlook?

Answer:

As you know I like MS Outlook because there a lot of possibilities and OLE 
automation of Outlook allow to solve possible any task. 

Today I want continue a serie of tips for MS Outlook. 

So how to read a collection of Contacts which are exist in MS Outlook? 

This task is very popular. For example, you want to develop a sample tool which 
will notify you about birthday for someone or you want to send messages to "mailing 
list". So you want to naviagte thru list of defined contacts and process any item. 

Below you'll find a sample code: 

1   const
2     olFolderContacts = $0000000A;
3   var
4     outlook, NameSpace, Contacts, Contact: OleVariant;
5     i: Integer;
6   begin
7     outlook := CreateOleObject('Outlook.Application');
8     NameSpace := outlook.GetNameSpace('MAPI');
9   
10    Contacts := NameSpace.GetDefaultFolder(olFolderContacts);
11    for i := 1 to Contacts.Items.Count do
12    begin
13      Contact := Contacts.Items.Item(i);
14      {now you can read any property of contact. For example, full name 
15  		and email address}
16      ShowMessage(Contact.FullName + ' <' + Contact.Email1Address + '>');
17    end;
18  
19    Outlook := UnAssigned;
20  end;


if you need a birthday, you can retrieve it as DateToStr(Contact.Birthday) 

Any contact item have a lot of properties. See a list (alphabet): 

Birthday 
Business2TelephoneNumber 
BusinessAddress 
BusinessAddressCity 
BusinessAddressCountry 
BusinessAddressPostalCode 
BusinessAddressPostOfficeBox 
BusinessAddressState 
BusinessAddressStreet 
BusinessFaxNumber 
BusinessHomePage 
BusinessTelephoneNumber 
CompanyAndFullName 
CompanyMainTelephoneNumber 
CompanyName 
ComputerNetworkName 
Department 
Email1Address 
Email1AddressType 
Email1DisplayName 
Email2Address 
Email2AddressType 
Email2DisplayName 
Email3Address 
Email3AddressType 
Email3DisplayName 
FirstName 
FTPSite 
FullName 
FullNameAndCompany 
GovernmentIDNumber 
Hobby 
Home2TelephoneNumber 
HomeAddress 
HomeAddressCity 
HomeAddressCountry 
HomeAddressPostalCode 
HomeAddressPostOfficeBox 
HomeAddressState 
HomeAddressStree 
HomeFaxNumber 
HomeTelephoneNumber 
Initials 
ISDNNumber 
JobTitle 
Language 
LastName 
LastNameAndFirstName 
MailingAddress 
MailingAddressCity 
MailingAddressCountry 
MailingAddressPostalCode 
MailingAddressPostOfficeBox 
MailingAddressState 
MailingAddressStreet 
MiddleName 
NickName 
OfficeLocation 
OrganizationalIDNumber 
PersonalHomePage 
PrimaryTelephoneNumber 
Profession 
Suffix 
Title 
WebPage 

			
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