Solved

Outlook Email Addressbook

Posted on 2004-04-01
5
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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