zvi_kleiner
asked on
need help!!! how to edit the outlook address book using MAPI
Can some 1 tell me how to add/extrect data from the contacts list in outlook using delphi MAPI
I managed to make a valid Session by using the function MAPILogon
MAPILogon(0,'','',0,0,@hSe ssion);
Where hSession is defined as ULONG, the function returnd SUCCESS_SUCCESS.
next I used
MapiAddress(hSession,0,'', 0,'',0,rec ips,MAPI_L OGON_UI,0, 0,newrecip s);
it displayed a standard address-list dialog box
The problem is what to do now, ho can I get all the address book list to a DBGrid
I managed to make a valid Session by using the function MAPILogon
MAPILogon(0,'','',0,0,@hSe
Where hSession is defined as ULONG, the function returnd SUCCESS_SUCCESS.
next I used
MapiAddress(hSession,0,'',
it displayed a standard address-list dialog box
The problem is what to do now, ho can I get all the address book list to a DBGrid
ASKER
Edited text of question.
ASKER
Bruintje thanks for the samples.
I was wandering if I can get more then
a Name an Email from the address Book.
I need the whole DataBase ?????!!!!!
I was wandering if I can get more then
a Name an Email from the address Book.
I need the whole DataBase ?????!!!!!
Hello,
Yes you can get more.
You could use code from this procedure.
And use objAddresses.AddressEntrie s.Item(i). Property to get more from the 'whole database'.
Offcourse you need to import the outlook library for this. You can create an Outlook instance with:
FOutlook := CreateOleObject('Outlook.A pplication ');
FOutlook is an OleVariant.
procedure TOutlookAdres.OleGetNamenE nEmail(var stringlist:TStringList);
{************************* ********** ********** ********** ****
pre: outlook is running
discription: get name+email, put them in TStringList
inputs: var TStringList
returns: var TStringList
************************** ********** ********** ********** ***}
var
objNS, objAddressLists, objAddresses: Olevariant;
i, k: integer;
s : string;
begin
FOutlook := GetActiveOleObject('Outloo k.Applicat ion');
objNS:= FOutlook.GetNamespace('MAP I');
objAddressLists:= objNS.AddressLists;
objAddresses:= objAddressLists.Item(1);
k:= objAddresses.AddressEntrie s.Count;
for i:=1 to k do
begin
s := (objAddresses.AddressEntri es.Item(i) .Name+', Email: '+objAddresses.AddressEntr ies.Item(i ).Address) ;
stringlist.add(s);
end;
end;
Greetings,
Floris.
Yes you can get more.
You could use code from this procedure.
And use objAddresses.AddressEntrie
Offcourse you need to import the outlook library for this. You can create an Outlook instance with:
FOutlook := CreateOleObject('Outlook.A
FOutlook is an OleVariant.
procedure TOutlookAdres.OleGetNamenE
{*************************
pre: outlook is running
discription: get name+email, put them in TStringList
inputs: var TStringList
returns: var TStringList
**************************
var
objNS, objAddressLists, objAddresses: Olevariant;
i, k: integer;
s : string;
begin
FOutlook := GetActiveOleObject('Outloo
objNS:= FOutlook.GetNamespace('MAP
objAddressLists:= objNS.AddressLists;
objAddresses:= objAddressLists.Item(1);
k:= objAddresses.AddressEntrie
for i:=1 to k do
begin
s := (objAddresses.AddressEntri
stringlist.add(s);
end;
end;
Greetings,
Floris.
ASKER
Thenk's Floris I will accept ur comment as the answer. I just need to know what
are all the property's.
besides Name & Address property
are all the property's.
besides Name & Address property
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
in case you could use a sample
http://www.econos.de/software/borland/email2/
HTH:O)Bruintje