BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the address list from MS Exchange Server?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
lsg
Guest





PostPosted: Wed Dec 10, 2003 11:27 pm    Post subject: How to get the address list from MS Exchange Server? Reply with quote




Hi,
I would like to get the mailing address list from MS exchange
Server and put them in my NMSMTP1.PostMessage.ToAddress.Text.
Can someone teach me how to do it?
Thanks.
lsg
Back to top
Ivan Borissov
Guest





PostPosted: Thu Dec 11, 2003 7:23 am    Post subject: Re: How to get the address list from MS Exchange Server? Reply with quote



See
http://www.imibo.com/imidev/delphi/les/index.html
- Extended MAPI in DELPHI
(Microsoft Exchange Server 5.5 / Microsoft Exchange Server 2000 compatibles
/ DELPHI 5, 6, 7 compatibles)
- Example # 2 Retrieve MS Exchange GAL (Global Address List)

or/and

http://www.imibo.com/imidev/delphi/les/cdoless.html
- CDO 1.2.1 in DELPHI
(MS Exchange Server 5.5 Edition / Microsoft Exchange Server 2000 compatibles
/ DELPHI 5 Edition / DELPHI 6 compatibles)
- Example # 2 Retrieve MS Exchange GAL (Global Address List)


"lsg" <samuelling (AT) hotmail (DOT) com> wrote

Quote:

Hi,
I would like to get the mailing address list from MS exchange
Server and put them in my NMSMTP1.PostMessage.ToAddress.Text.
Can someone teach me how to do it?
Thanks.
lsg



Back to top
Eric Engler
Guest





PostPosted: Thu Dec 11, 2003 3:32 pm    Post subject: Re: How to get the address list from MS Exchange Server? Reply with quote



Try this (you need to add MAPI and ComObj to uses):

procedure TForm1.BtnGetUsersClick(Sender: TObject);
var
OutlookApp, MapiNamespace, AddrList, AddressEntries: Variant;
AddrEntry: string;
begin
//Get the Outlook Application object.
OutlookApp := CreateOleObject('Outlook.Application');

//Get the MAPI NameSpace object.
MapiNamespace := OutlookApp.GetNameSpace('MAPI');
AddrList := MapiNamespace.AddressLists('Global Address List');
AddressEntries := AddrList.AddressEntries;

try
try
ListBox1.Items.Clear;
AddrEntry := AddressEntries.GetFirst;
repeat
ListBox1.Items.Add(AddrEntry);
AddrEntry := AddressEntries.GetNext;
until false;
except
// we must be at the end
end;
finally
ListBox1.Items.Add(AddrEntry);
OutlookApp := NULL;
end;
end;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.