Problems with HrSzFromEntryID() and HrEntryIDFromSz() using
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Problems with HrSzFromEntryID() and HrEntryIDFromSz() using

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
Bruce
Guest





Posted: Fri Sep 09, 2005 12:59 am    Post subject: Problems with HrSzFromEntryID() and HrEntryIDFromSz() using Reply with quote

I am trying to figure out what is wrong with this code sample. I want to be
able to convert an ENTRY_ID for a mail message from ENTRYID to STRING and
back. From what I can tell in the documentation, this should work. I have
outlook 2003 with all the updates installed.

mapi32.dll Info:
Extended MAPI 1.0 for Windows NT
File Version: 1.0.2536.0

Running on Windows XP Pro.

bin.cb = 0x00000018
bin.lpb points to short term ENTRYID data from a message.

All I am doing is converting an message's entryid it to a string and back
again.

The string the entryid is converted to is:
"08[P```"V"_D;[<+!'C7[7,^P,L5D$4S<`"


When I try to convert it back I get the following results:
HRESULT: 0x80040107
lcbTemp = 0x0000004e
lpTempEntryID= 0


HERE IS THE CODE SAMPLE

// Convert ENTRYID to STRING
LPTSTR lpszEntryID = NULL;

HrSzFromEntryID(
pRows->aRow[i].lpProps[ePR_ENTRYID].Value.bin.cb
, (LPENTRYID)pRows->aRow[i].lpProps[ePR_ENTRYID].Value.bin.lpb
, &lpszEntryID
);

TRACE("EntryID: %s\n",lpszEntryID);

// Convert STRING to ENTRYID
ULONG lcbTemp = 0;
LPENTRYID lpTempEntryID = NULL;
HRESULT hrReturnTemp = HrEntryIDFromSz(lpszEntryID, &lcbTemp,
&lpTempEntryID);

if (lpTempEntryID)
{
MAPIFreeBuffer(lpTempEntryID);
lpTempEntryID = NULL;
}

if (lpszEntryID)
{
MAPIFreeBuffer(lpszEntryID);
lpszEntryID = NULL;
}

--
Thanks,
Bruce

Back to top
Dan Mitchell
Guest





Posted: Sat Sep 10, 2005 12:58 am    Post subject: Re: Problems with HrSzFromEntryID() and HrEntryIDFromSz() us Reply with quote

"Bruce" <bwolven@nospam.nospam> wrote in
news:e5ITVwLtFHA.1472@TK2MSFTNGP15.phx.gbl:
Quote:
ULONG lcbTemp = 0;
LPENTRYID lpTempEntryID = NULL;
HRESULT hrReturnTemp = HrEntryIDFromSz(lpszEntryID, &lcbTemp,
&lpTempEntryID);

The problem is that these functions are designed for going between
Simple MAPI and Extended MAPI; from the docs for HrSzFromEntryID:

"When the client finds the entry identifier for the desired message, it
can call HrSzFromEntryID to convert the entry identifier to a Simple
MAPI identifier string so the message can be manipulated in Simple MAPI.
"

So far, so good.

"Then the client can call the Simple MAPI MAPIReadMail function to
retrieve the required information about the message. "

In other words, that ENTRYID is meant to be passed to MAPIReadMail, not
HrEntryIDFromSz. You'd think those functions would be symmetrical with
ExMAPI ENTRYIDs, but I guess not. It looks very much as if the to-string
function is turning it into a human-readable string, too, which is a bit
suspicious.

You probably want the HexFromBin and FBinFromHex functions.

-- dan
Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
Contact Us
New Topics Powered by phpBB