Solved

Outlook Email Addressbook

Posted on 2004-04-01
5
215 Views
Last Modified: 2010-04-05
Hello !
  I've created a little application which get's a list of email addresses from the outlook addressbook (on an exchange server) along with their login name.  

Does anyone know if its possible to just return names (rather than groups) from the email address list ?

Also does anyone know if its possible to return their alias ?  (When you right click a name, chose properties it displays it there).

This is the addressbook NOT the contact list.

Many thanks in advance.
0
Comment
Question by:Togs
5 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10730940
maybe this can help?

uses Mapi

procedure TForm1.Button1Click(Sender: TObject);
Function GetAddressBookNames(const ToList,CCList,BCCList: TStrings; DialogCaption: String): Boolean;
  type
  AFUlong = Cardinal; //Windows.ULONG Type compatibility for D3
var
  lpRecip: TMapiRecipDesc;
  intRecips: AFULONG;
  lpRecips: PMapiRecipDesc;
  i: Integer;
  NumberOfEditFields: Cardinal ;
begin
  NumberOfEditFields := 0;
  If (ToList <> Nil) or  (CCList <> Nil) or (BCCList <> Nil) then
    Inc(NumberOfEditFields);
  result := False;
  if (MAPIAddress(0, Application.Handle, PChar(DialogCaption),
    NumberOfEditFields, '', 0, lpRecip, 0, 0, @intRecips, lpRecips) =
    SUCCESS_SUCCESS) then
  begin
    If NumberOfEditFields > 0 then
    begin
      for i := 0 to intRecips-1 do
        case PMapiRecipDesc(PChar(lpRecips) + i*SizeOf(TMapiRecipDesc))^.
          ulRecipClass of
          MAPI_TO:
            If ToList <> nil then ToList.Add(PMapiRecipDesc(PChar(lpRecips) +
              i*SizeOf(TMapiRecipDesc))^.lpszName);
          MAPI_CC:
            If CCList <> nil then CCList.Add(PMapiRecipDesc(PChar(lpRecips) +
              i*SizeOf(TMapiRecipDesc))^.lpszName);
          MAPI_BCC:
            If BCCList <> nil then BCCList.Add(PMapiRecipDesc(PChar(lpRecips)
              + i*SizeOf(TMapiRecipDesc))^.lpszName); //.lpszAddress for Address....
        end;
      result := True;
    end;
  end;
  MAPIFreeBuffer(lpRecips);
end;
begin
getaddressbooknames(listbox1.Items,nil,nil,'');
end;
0
 

Author Comment

by:Togs
ID: 10731041
Thanks for that although it doesn't quite help my problem.  

I need to check a login (for example one you log into the network with 'test07' which then has an email account based on this login 'test07').

I have statics in my application which upon certain events automatically email specific logins (for example 'test07').  However when these are removed from the exchange server and not the application it produces problems with my application (allows the users to type their own email addresses in and due to the poor handling of windows in XP also sometimes get stuck behind other windows).
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13276107
PAQed with points refunded (60)

modulo
Community Support Moderator
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question