Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MapiAddress: Returning MapiRecipDesc problem

Posted on 2000-04-17
1
Medium Priority
?
544 Views
Last Modified: 2012-05-07
I've been calling the MapiAddress function with the code below,

only the problem is retrieving multiple addresses, i can retrieve one, but i get stuck on making an array of it again..

if anyone can help, please..

function TNovaMapi.AddressList: MapiRecipDesc;
var
 Flags     : Cardinal;
 pmrd      : amrd;
 mrd       : PMapiRecipDesc;
 mrd2      : PMapiRecipDesc;
 t         : cardinal;
 I         : integer;
 Success   : Boolean;
begin
 mrd  := @pmrd;
 mrd2 := @pmrd;
 t := 1;
 Success := False;

 case fNMEditFields of
  ef0: i := 0;
  ef1: i := 1;
  ef2: i := 2;
  ef3: i := 3;
  ef4: i := 4;
  else I := 0;
 end;
// Set Flags to use
 Flags := 0;
 if opShowDialogs then Flags := MAPI_LOGON_UI;
 if opUseSeparateSession then Flags := Flags + MAPI_NEW_SESSION;

 case MapiAddress(fMapiSession^,fDlgParent.Handle,@fLstCaption,I,@fToString,0,mrd2^,Flags,0,@t,mrd) of
  MAPI_E_FAILURE: Application.MessageBox(strERROR,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_INSUFFICIENT_MEMORY: Application.MessageBox(strMEMORYSHORT ,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_INVALID_EDITFIELDS: Application.MessageBox(strADDR_EDITFLDS ,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_INVALID_RECIPS: Application.MessageBox(strADDR_RECIP ,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_INVALID_SESSION: Application.MessageBox(strADDR_SESSION,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_LOGON_FAILURE: Application.MessageBox(strLOGIN_FAILED,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  MAPI_E_NOT_SUPPORTED: Application.MessageBox(strNO_OP_SUPPORT,'Error: MapiAddress',MB_OK+MB_ICONERROR);
  SUCCESS_SUCCESS: Success := True;
  Else
   Application.MessageBox(strUNKNOWN_ERROR,'Error: MapiAddress',MB_OK+MB_ICONERROR);
 end;

 if success then Result := mrd^;

 MapiFreeBuffer(mrd);
 MapiFreeBuffer(mrd2);
end;


0
Comment
Question by:FallenGod
[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
1 Comment
 
LVL 2

Accepted Solution

by:
Ten13 earned 200 total points
ID: 2731481
You cannot return the array of recipients. You have to process the array of recipients and then call MAPIFreBuffer. Eg:

var
  pNewRecipients : PMapiRecipDesc;

  MAPIAddress(fMapiSession^,fDlgParent.Handle,@fLstCaption,I,@fToString,0,mrd2^,Flags,0,@t,mrd); // your call
  pNewRecipients:= mrd;
  for n:= 1 to t do begin
    GetRecipentInfo(pNewRecipients^);
    Inc(pNewRecipients, 1);
  end;
  MAPIFreeBuffer(mrd);

The definition of GetRecipentInfo looks like this:
procedure GetRecipentInfo(mrd : TMapiRecipDesc);

Thats it. No more no less. Good luck!

- Martin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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