Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 12 Sep 2007 18:12:28 -0400,    group: microsoft.public.platformsdk.messaging        back       


Problem with embedded message attachment   
Hello everyone,

I'm trying to insert a .msg file as an embedded message attachment in a 
message but the embedded message which gets created is not valid and I 
cannot open it in Outlook. Here is what I do.

1.) Create embedded attachment on pIMsg (parent message) using CreateAttach
2.) Set PR_ATTACH_METHOD on attachment
3.) Load xyz.msg file to IMessage lpSrcEmbMsg
4.) Open PR_ATTACH_DATA_OBJ property of attachment as IMessage lpEmbdMsg
5.) Copy Source msg properties to attachment using CopyTo
6.) SaveChanges on embedded message, set other attachment properties, save 
attachment and save parent message

The code snippet is below. Can someone suggest me what's wrong with this 
code?

if(ATTACH_EMBEDDED_MSG == ulAttachMethod)
{

pIMsg->CreateAttach(NULL, 0, &ulAttachNum, &lpAttach);

Prop.ulPropTag = PR_ATTACH_METHOD;
Prop.Value.l = ulAttachMethod ;

hr = HrSetOneProp((IMAPIProp*)lpAttach, &Prop);

LPMESSAGE lpEmbdMsg = NULL;
LPMESSAGE lpSrcEmbMsg = NULL;

LoadMSGToMessage("XYZ.msg", &lpSrcEmbMsg);


 lpAttach->OpenProperty(PR_ATTACH_DATA_OBJ, &IID_IMessage, 0, 
MAPI_CREATE|MAPI_MODIFY, (LPUNKNOWN *)&lpEmbdMsg)))

hr = lpSrcEmbMsg->CopyTo(0, NULL, NULL, NULL, NULL,(LPIID)&IID_IMessage, 
lpEmbdMsg, 0, NULL);

lpEmbdMsg->SaveChanges(0);
lpEmbdMsg->Release();
lpEmbdMsg= NULL;

lpSrcEmbMsg->Release();
lpSrcEmbMsg = NULL;

}


// SET PROPERTIES ON lpAttach HERE

lpAttach->SaveChanges(0);
pIMsg->SaveChanges(0);



Thanks in advance!
Varun
date: Wed, 12 Sep 2007 18:12:28 -0400   author:   Varun Bansal

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us