Jason Coley asked me:
> Do you know how to use the getProps to get more than one property, I
> can't seem to get more than one, so I thought the code maybe faster if I
> used the GetOneProp, but that may just use the GetProps as your code
> does. So do you know how to get more than one at a time?
You use the GetProps method on the IMAPIProps interface, but instead of the
simple code I have used before you need to create your own tag array to
handle the problem that MAPI uses the old C style arrays of the end of
record trick, and that relies on no array index bounds checking being used.
Then the pointer you get back is actually a pointer to an array of values
that you can itterate over. Some thing like this:
const
TagCount = 2;
type
TTagArray = record
cValues: ULONG;
aulPropTag: array[0 .. TagCount - 1] of ULONG
end;
var
TagArray: TTagArray;
PropCount: ULONG;
Props: PSPropValue;
AProp: PSPropValue;
FolderMask: Integer;
EntryID: PENTRYID;
begin
TagArray.cValues := 2;
TagArray.aulPropTag[0] := PR_VALID_FOLDER_MASK;
TagArray.aulPropTag[1] := PR_IPM_OUTBOX_ENTRYID;
Result := pmp.GetProps(@TagArray, 0, PropCount, Props);
if Result = MAPI_W_ERRORS_RETURNED then
begin
MAPIFreeBuffer(Props);
Exit
end;
AProp := Props;
// Fetch first property
FolderMask := AProp.Value.l;
// fetch second property
Inc(AProp);
EntryID := PENTRYID(AProp.Value.bin.lpb);
// Must free the buffer returned when your done with it
MAPIFreeBuffer(Props);
end;
This can be extended all the way up to as many tags as you need to fetch at
once, and with some extra effort you could even use const arrays to pass in
tags and variant arrays to return the results.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/