Board index » cppbuilder » Problem reading PR_BODY in Outlook 2003
habanero_2001
![]() CBuilder Developer |
Problem reading PR_BODY in Outlook 20032006-05-04 06:09:38 AM cppbuilder6 I have used Extended MAPI to read a Message Body (plain text) succcessfully in Microsoft Outlook 2000 and 2002 using C++ Builder: char *bodybuf=0; unsigned int bodysize=0; IStream *istream; hr = imsg->OpenProperty(PR_BODY, &IID_IStream, STGM_READ, 0, (IUnknown**)&istream); if (hr==S_OK) { STATSTG stg = {0}; hr = istream->Stat(&stg,STATFLAG_NONAME); if (hr==S_OK) { bodysize = stg.cbSize.LowPart; bodybuf = new char[bodysize+1]; ULONG red; hr = istream->Read(bodybuf, bodysize, &red); if (hr!=S_OK) bodysize=0; else if (red<bodysize) bodysize=red; bodybuf[bodysize]=0; } istream->Release(); } But the problem happens when I read a message in Microsoft Outlook 2003: body lines are wrapped at no more than 70 characters per line with phisical \r\n which are not present in the message body if I open the message and copy its body and paste it in the notepad. I read the same message in Outlook 2002 and the plain text is correct, without these extra \r\n. I guess it could be a parameter to get the message's plain text without any wrap. I have tried reading PR_BODY_HTML and it does not contain the \r\n but I am interested in the plain text, and I wouldn't like to remove all HTML tags. Any idea? |