Solved

Outlook Email Addressbook

Posted on 2004-04-01
5
212 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now