Board index » delphi » getting a users email address book

getting a users email address book

Hello,

I developed a specialized file manager for my clients in Delphi 5.  I am
currently giving them access to email from my file manager.  In my email
dialog I would like to give them access to their email address book for
selecting the people they would like to email.  I could not find any
documentation on this subject in the help files.  Does anyone know how I
would go about getting this information?  Thanks for all your help.

Thanks,
Maria

 

Re:getting a users email address book


You don't know what you are asking! Assuming you are using Outlook2000
(earlier versions will NOT work) and Exchange you can use the following
brute force method:
Bruce

var
   i,NumCount: Integer;
   ts: TStringList;
   PickedItem: string;
   s,s1: string;
   HasEntry: Boolean;
   LoopProps: Integer;
   EntryValue: String;
   V, RecipColl, RecipObj, AddressEntry, Fields,
   ThisItem: Variant;

begin

  try
     { Create a MAPI Session: }
     try
       V:=CreateOleObject('MAPI.Session');
     except
       Exit;
     end;

     { Logon to MAPI: }
     try
       V.Logon;
     except
       Exit;
     end;

     { Open address book: }
     try
       RecipColl:=V.AddressBook(toLabel:='Pick');
     except
       Exit;
     end;

        { One or more entries selected: }
        if RecipColl.Count>0 then
           begin

           ts:=TStringList.Create;
           try

              { Recipient object: }
              RecipObj:=RecipColl.Item[1];
              { AddressEntry object of this recipient object: }
              AddressEntry:=RecipObj.AddressEntry;
              { Fields object of this AddressEntry object: }
              Fields:=AddressEntry.Fields;

              for LoopProps:=Low(MapiProps) to High(MapiProps) do
                 begin

                 HasEntry:=True;

                 try
                   ThisItem:=Fields.Item[MapiProps[LoopProps]];
                   EntryValue:=ThisItem.Value;
                 except
                   EntryValue:='No Entry';
                   HasEntry:=False;
                 end;

                 if HasEntry and
                    (EntryValue<>'No Entry') and
                    (pos('@',EntryValue)>0)
                    then ts.Add(trim(EntryValue));

                 end;

              //.. process the information

              finally
                 ts.free;
              end
              end;

---------------

Quote
> documentation on this subject in the help files.  Does anyone know how I
> would go about getting this information?  Thanks for all your help.

> Thanks,
> Maria

Re:getting a users email address book


Hi Maria,

You might want to try this link

http://www.delphizine.com/features/1999/09/di199909bt_f/di199909bt_f.asp

Quote
"Maria Makki" <softs...@mindspring.com> wrote in message

news:8qeek8$m6428@bornews.borland.com...
Quote
> Hello,
> currently giving them access to email from my file manager.  In my email
> dialog I would like to give them access to their email address book for

Re:getting a users email address book


Hello,

I developed a specialized file manager for my clients in Delphi 5.  I am
currently giving them access to email from my file manager.  In my email
dialog I would like to give them access to their email address book for
selecting the people they would like to email.  I could not find any
documentation on this subject in the help files.  Does anyone know how I
would go about getting this information?  Thanks for all your help.

Thanks,
Maria

Other Threads