Thanks
Sachin
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Sachin" <Sac...@discussions.microsoft.com> wrote in message
news:A916C14D-B580-4F4C...@microsoft.com...
pImsg->OpenProperty(PR_HTML, &IID_IStream, STGM_READ, 0,
(IUnknown**)&istream);
i have built pImsg on the top of loose msg using
hRes = OpenIMsgOnIStg(pMsgSession, MAPIAllocateBuffer, MAPIAllocateMore,
MAPIFreeBuffer, pMalloc, NULL, pStorage, NULL, 0, MAPI_UNICODE, &pIMsg);
any idea why it should fail ? the message file is HTML formatted ..
Sachin
"Ken Slovak - [MVP - Outlook]" wrote:
> Getting error 0x8004010f when i tried to use PR_HTML property
>
> pImsg->OpenProperty(PR_HTML, &IID_IStream, STGM_READ, 0,
> (IUnknown**)&istream);
What do MfcMapi and/or OutlookSpy do when you try to
access PR_HTML?
--
SvenC
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sachin" <Sac...@discussions.microsoft.com> wrote in message
news:46A62178-422C-41E8...@microsoft.com...
returns S_OK
but how to read the istread content will istream->Read help or do i have to
take another approach as the proeprty is BINARY and not STRING type.
Sachin
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sachin" <Sac...@discussions.microsoft.com> wrote in message
news:A7F5F169-8C91-492A...@microsoft.com...
i have also tried reading PR_RTF_COMPRESSED property.
hr = pIMsg->OpenProperty(
PR_RTF_COMPRESSED, &IID_IStream, STGM_READ,NULL, (LPUNKNOWN *) &istream);
//hr == S_OK
then i tried to decompress the stream
pfnWrapEx( lpCompressedRTFStream, &wcsinfo, lpUncompressedRTFStream,
&retinfo);
// here pfnWrapEx is function pointer to WrapCompressedRTFStreamEx
*(lpUncompressedRTFStream)->Read(szBody, 1024, &ulRead)
THIS RETURN szBody which looks corrupted or characters could not be
recognized .. i have tried both Code page CP_ACP and CP_UTF8
should there be any problem for unicode build of my program?
sachin
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sachin" <Sac...@discussions.microsoft.com> wrote in message
news:BB3D77BF-C745-4CF9...@microsoft.com...
> // pfnWrapEx is a function pointer to "WrapCompressedRTFStream@12"
> in the library version which i have i cant see WrapCompressedRTFStreamEx
> function exported instead the name is "WrapCompressedRTFStream@12"
> So i assume this is the same as WrapCompressedRTFStreamEx
It cannot be the same because @12 indicates that 3 params are used but
the Ex version takes 4 params.
Download MFCMapi sources from here:
http://www.codeplex.com/MFCMAPI
That is *the* MAPI sample application and you should find how to
find the right proc and how to call it.
--
SvenC
Following is snapshot of the code
I got few sample from the net and tried it but did not work i am till
getting bad data in the buffer.
HRESULT CMapilibrary::WrapStreamForRTF( LPSTREAM lpCompressedRTFStream, BOOL
bUseWrapEx, ULONG ulFlags, ULONG ulInCodePage, ULONG ulOutCodePage, LPSTREAM
FAR * lpUncompressedRTFStream, ULONG FAR * pulStreamFlags)
{
if (!lpCompressedRTFStream || !lpUncompressedRTFStream)
return MAPI_E_INVALID_PARAMETER;
HRESULT hRes = E_FAIL;
{
if (pfnWrapEx)
{
RTF_WCSINFO wcsinfo = {0};
RTF_WCSRETINFO retinfo = {0};
retinfo.size = sizeof(RTF_WCSRETINFO);
wcsinfo.size = sizeof (RTF_WCSINFO);
wcsinfo.ulFlags = ulFlags;
wcsinfo.ulInCodePage = ulInCodePage; // Get ulCodePage from
PR_INTERNET_CPID on the IMessage
wcsinfo.ulOutCodePage = ulOutCodePage; // Desired code page for return
hRes = pfnWrapEx( lpCompressedRTFStream, &wcsinfo,
lpUncompressedRTFStream, &retinfo);
*pulStreamFlags = retinfo.ulStreamFlags;
}
else
{
fwprintf(LogFile , L"\n failed to extract RTF Body");
}
}
return hRes;
}
// pfnWrapEx is a function pointer to "WrapCompressedRTFStream@12"
in the library version which i have i cant see WrapCompressedRTFStreamEx
function exported instead the name is "WrapCompressedRTFStream@12"
So i assume this is the same as WrapCompressedRTFStreamEx
After decompresin the String i have called Read Method on it
like
body = new WCHAR[bodySize+sizeof(WCHAR)];
memset(body, 0, bodySize+sizeof(WCHAR));
hr = lpUncompressedRTFStream->Read(body, bodySize, &red);
if (hr == S_OK)
{
if (red < bodySize)
{
wprintf(L"\nRead from Email may be incomplete");
fwprintf(LogFile, L"\n Read from Email may be incomplete");
}
}
else
{
throw SE_Exception(MESSAGE_TEXT_EXTRACTION_PROBLEM) ;
}
-----------------------
but the body content is not readable and contains only boxes ..
Thanks
Sachin
i think i found the problem
1. now i am referring to MSMAPI32.dll instead of mapi32.dll which now
contains exported function for WrapCompressedRTFStreamEx
2. I was copying the data into WCHAR instead now i use ASCII buffer char*
in Read() operation so this worked and now i can see data in HTML format
-----------
I have one basic question in the same context ..
we have used PR_RTF_COMPRESSED property to read HTML mail body but i am bit
confused between difference between RTF and HTML email body
Sachin
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sachin" <Sac...@discussions.microsoft.com> wrote in message
news:B6C82329-0F11-4164...@microsoft.com...