I was trying to retrieve the body of a message using the code below but
It is always returning
MAPI-E-NOT-FOUND:
hr = m_pfldrInbox->OpenEntry(
m_pInbox[msgID].lpProps[0].Value.bin.cb,
(ENTRYID*)m_pInbox[msgID].lpProps[0].Value.bin.lpb,
NULL,
MAPI_MODIFY | MAPI_DEFERRED_ERRORS,
&ulObjType,
(LPUNKNOWN*)&lpMessage);
//MessageBox(0, L"Message Opened", L"", 0);
if (SUCCEEDED(hr))
{
SPropValue * rgMsgprops = NULL;
ULONG rgMsgTags[] = {1, PR_BODY};
ULONG cCount = 0;
// IStream* istream;
ULONG ulNumChars;
// hr = lpMessage->GetProps((LPSPropTagArray) rgMsgTags, MAPI_UNICODE,
&cCount, &rgMsgprops);
hr = HrGetOneProp(lpMessage,PR_SUBJECT,&rgMsgprops);
if (hr == MAPI_E_NOT_ENOUGH_MEMORY)
{
MessageBox(0, L"Not enough memory", L"", 0);
hr = lpMessage->OpenProperty(
PR_BODY,
&IID_IStream,
STGM_READ,
NULL,
(LPUNKNOWN *) &lpStream);
do
{
lpStream->Read(
sBuffer,
255,
&ulNumChars);
// if (ulNumChars >0) printf("%.*s",ulNumChars,szBuf);
}
while (ulNumChars >= 255);
// printf("\n");
hr = S_OK;
}
else if (hr == MAPI_E_NOT_FOUND)
{
//This is not an error. Many messages do not have
bodies.
//printf("Message has no body!\n");
MessageBox(0, L"Message has no body", L"", 0);
hr = S_OK;
}
else
{
//MessageBox(0, "%d", rgMsgprops[0].Value.lpszA, 0);
int x = 0;
do
{
sBuffer[x] = rgMsgprops[0].Value.lpszW[x];
x++;
//MessageBox(0, (LPCWSTR)sBuffer, L"", 0);
//bufferlen = strlen(rgMsgprops[0].Value.lpszW);
}while (((int)rgMsgprops[0].Value.lpszW[x-1] != NULL) && (x <
255));
}
}
If you can tell what is the problem please help. 1 3214 ma***********@gmail.com wrote: I was trying to retrieve the body of a message using the code below but It is always returning MAPI-E-NOT-FOUND:
hr = m_pfldrInbox->OpenEntry( m_pInbox[msgID].lpProps[0].Value.bin.cb, (ENTRYID*)m_pInbox[msgID].lpProps[0].Value.bin.lpb, NULL, MAPI_MODIFY | MAPI_DEFERRED_ERRORS, &ulObjType, (LPUNKNOWN*)&lpMessage); //MessageBox(0, L"Message Opened", L"", 0); if (SUCCEEDED(hr)) { SPropValue * rgMsgprops = NULL; ULONG rgMsgTags[] = {1, PR_BODY}; ULONG cCount = 0; // IStream* istream; ULONG ulNumChars; // hr = lpMessage->GetProps((LPSPropTagArray) rgMsgTags, MAPI_UNICODE, &cCount, &rgMsgprops);
hr = HrGetOneProp(lpMessage,PR_SUBJECT,&rgMsgprops); if (hr == MAPI_E_NOT_ENOUGH_MEMORY) { MessageBox(0, L"Not enough memory", L"", 0); hr = lpMessage->OpenProperty( PR_BODY, &IID_IStream, STGM_READ, NULL, (LPUNKNOWN *) &lpStream);
do { lpStream->Read( sBuffer, 255, &ulNumChars); // if (ulNumChars >0) printf("%.*s",ulNumChars,szBuf); } while (ulNumChars >= 255);
// printf("\n");
hr = S_OK; }
else if (hr == MAPI_E_NOT_FOUND) { //This is not an error. Many messages do not have bodies. //printf("Message has no body!\n"); MessageBox(0, L"Message has no body", L"", 0); hr = S_OK; } else {
//MessageBox(0, "%d", rgMsgprops[0].Value.lpszA, 0); int x = 0; do { sBuffer[x] = rgMsgprops[0].Value.lpszW[x]; x++; //MessageBox(0, (LPCWSTR)sBuffer, L"", 0); //bufferlen = strlen(rgMsgprops[0].Value.lpszW); }while (((int)rgMsgprops[0].Value.lpszW[x-1] != NULL) && (x < 255)); } }
If you can tell what is the problem please help.
You should probably take this to an Microsoft-specific group. See the
FAQ for some suggestions: http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mashhour.solh |
last post by:
I was trying to retrieve the body of a message using the code below but
It is always returning
MAPI-E-NOT-FOUND:
hr = m_pfldrInbox->OpenEntry(
m_pInbox.lpProps.Value.bin.cb,...
|
by: mashhour.solh |
last post by:
From: mashhour.solh@gmail.com - view profile
Date: Tues, May 9 2006 11:33 am
Email: "mashhour.s...@gmail.com" <mashhour.s...@gmail.com>
Groups: microsoft.public.dotnet.languages.vc
Not yet...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |