Re: How to Read mail body using MAPI

Tech-Archive recommends: Fix windows errors by optimizing your registry



Missing? What was the error code? Check like this:
if (PT_ERROR == PROP_TYPE(pVal[5].ulPropTag))
{
printf("Error: 0x%08X\n",pVal[5].Value.err);
}

As Dmitry pointed out - it's probably MAPI_E_NOT_ENOUGH_MEMORY.

You need to use OpenProperty and streams.

<visalavats@xxxxxxxxxxxxx> wrote in message
news:1177672147.528165.294390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 27, 12:28 pm, "Dmitry Streblechenko" <dmi...@xxxxxxxxxxx>
wrote:
Firstly, Exchange provider limits the amount of data retrieved in a
single
call to around 32 kB.
Secondly, for the PR_BODY property, Exchange provider (depending on the
version) will either return an error if the body is too large or will
truncate it to 255 characters.
Thirdly, your code never checks that the expected property is returned.
If a
particular property is missing or it cannot be returned, the property
type
(lower 2 bytes) will be chnaged to PT_ERROR and SPropValue.Value.err will
contain the appropriate error code (e.g. MAPI_E_NOT_ENOUGH_MEMORY).
You must check the property type:

if (pval[5].ulPropTag == PR_BODY)
{
...

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<visalav...@xxxxxxxxxxxxx> wrote in message

news:1177651252.753255.193280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



On Apr 26, 9:43 pm, "Dmitry Streblechenko" <dmi...@xxxxxxxxxxx> wrote:
Do you have a relevant snippet of your code that produces garbage?

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<visalav...@xxxxxxxxxxxxx> wrote in message

news:1177592943.724321.327010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi,

Please help in reading the mail content , I am only able to read the
subject and other stuffs but when it comes to body PR_BODY the
content
is showing some junk values.

Is it possible to read mail body?????
I have been trying from many days please help me

Thanks
Vishal- Hide quoted text -

- Show quoted text -

/////////////////////
Hi,
The code is ...

void VishMapiTest()
{

IMAPISession *mapiSession = NULL;
IMsgStore *messageStore = NULL;
IMAPIFolder *inboxFolder = NULL;
IMAPITable *contents = NULL;
IMessage *message = NULL;

SRowSet *row = NULL;
SPropValue *properties = NULL;
ULONG values = 0;
HRESULT result = S_OK;
SPropValue *pval = NULL;

//Initialize
MAPIInitialize(NULL);
//Logon
MAPILogonEx(0, NULL, NULL, 0, (LPMAPISESSION *)&mapiSession);
//Open Message Store
mapiSession->OpenMsgStore(NULL, 0, NULL, NULL, 0, &messageStore);

// Open Inbox table
ULONG tags[] = { 1, PR_CE_IPM_INBOX_ENTRYID };
//
messageStore->GetProps((LPSPropTagArray)tags,
MAPI_UNICODE,
&values,
&properties);

// Open the entry ( Getting the Interface for Inbox Folder )
messageStore->OpenEntry(
properties[0].Value.bin.cb,
(LPENTRYID)properties[0].Value.bin.lpb,
NULL,
0,
NULL,
(LPUNKNOWN*)&inboxFolder);

GetPropsExample(&message);

inboxFolder->GetContentsTable(0, &contents);

SizedSPropTagArray(8/*Column_NumberOfColumns*/, columns) =
{
8/*Column_NumberOfColumns*/,
PR_ENTRYID,
PR_MESSAGE_FLAGS,
PR_SENDER_NAME,
PR_SUBJECT,
PR_MESSAGE_DELIVERY_TIME,
PR_BODY,
0x00010000, // PR_BODY_HTML, see MSDN
PR_RTF_COMPRESSED
};

contents->SetColumns((LPSPropTagArray)&columns, 0);
while(S_OK == (result = contents->QueryRows(1, 0, &row)))
{
// Column 0 - 4 contain the expected properties
// Columns 5 - 7 all contain NULL Values

pval = row->aRow[0].lpProps;

/
*****************************************************************/
pval[0-4] works properly
pval[5] does't work it should be PR_BODY its coming as junk

}

}// End of Function

Please help me...............

Thanks
Vishal- Hide quoted text -

- Show quoted text -

The PR_BODY is missing .............
Please help me



.



Relevant Pages

  • Re: most bizarre libc.so.7 problem
    ... mkdir -p /tmp/install.ljWDSoNZ ... for prog in [awk cap_mkdb cat chflags chmod chown date echo egrep find grep install-info ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl test true uname wc zic; do cp `which $prog` /tmp/install.ljWDSoNZ; done ... 12 ./boot/defaults missing ... 57 *** Error code 1 ...
    (freebsd-questions)
  • Re: event type: error the hpdj service failed to start
    ... Missing or corrupted files, ... of this error see the link to error code 20. ... system cannot find the file specified" error see the link error code 2. ... For generic information about the "The parameter is incorrect" error see the ...
    (microsoft.public.windowsxp.perform_maintain)
  • buildworld fails as non-root user
    ... *** Error code 1 ... ./bsnmp missing ... ./bsnmp: warning: file mode not set ...
    (freebsd-current)
  • failure building nanobsd with FreeBSD Stable
    ... for prog in [awk cap_mkdb cat chflags chmod chown date echo egrep find ... ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl test true uname ... ./boot missing ... *** Error code 2 ...
    (freebsd-stable)
  • Re: cant add member to Distribution List
    ... OutlookSpy - Outlook, CDO ... and MAPI Developer Tool ... with error code 0x80070057 ...
    (microsoft.public.win32.programmer.messaging)