We have a scenario where we transfer the Emails in outlook to our
application. We will read the email data using javascript using the outlook
API.
I’m facing a problem when I tried to read the email which has an .MSG
attachment. Normally other attachments can be read using
var cdoAttachments = cdoItem.Attachments;
// name of attachment
try{
l_attName =
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_LONG_FILENAME);
} catch(e) {
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Attribute
CdoPR_ATTACH_LONG_FILENAME", e);
try {
l_attName =
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_FILENAME);
} catch(e) {
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Attribute
CdoPR_ATTACH_FILENAME", e);
l_attName =
cdoAttachments.Item(i).Fields.Add(CdoPR_ATTACH_FILENAME, "");
}
}
// MIME-Type
try{
var l_attMIME =
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_MIME_TAG);
} catch(e) {
var l_attMIME = OI_GetMIMEFromExt(""+l_attName);
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Attribute
CdoPR_ATTACH_MIME_TAG", e);
}
// CID
try{
var l_attCID =
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_CONTENT_ID);
l_attCID = (l_attCID == null) ?
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_CONTENT_ID_W) :
l_attCID;
} catch (e) {
var l_attCID = "";
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Attribute
CdoPR_ATTACH_CONTENT_ID(_W)", e);
}
// binary of attachment
try{
ls_helper = "Content"
var l_attach =
cdoAttachments.Item(i).Fields(CdoPR_ATTACH_DATA_BIN); // see catch if not
readable
l_Bound.appendChild(OI_CreateXMLElement( l_XML, ls_helper,
l_attach, "Text", oi_MIME_BINARY));
} catch (e) {
// for some RTF email, the converted HTML is not readable from
the Object Model,
// then just write "<< attachment/image name >>"
// alert(otr_oi_err_xml_mail_attrib + "'" + ls_helper + "'");
// ls_helper = "Content"
// l_Bound.appendChild(OI_CreateEncodedTypedXMLElement(l_XML,
ls_helper, "<< " + l_attName + " >>" , "Text", oi_MIME_ASCII, false));
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Cannot get binary of
attachment", e);
}
} catch (e) {
alert( otr_oi_err_xml_attach_1 + "["+(i+1)+"]" +
otr_oi_err_xml_attach_2); // "XML-Fehler: Das Attachment ["+(i+1)+"] konnte
nicht gelesen werden.");
OI_IF_Debug_Errorln("l_OI_IF_MailToXML", "Cannot read attachment
["+(i+1)+"]", e);
}
All the other attachment data can be read using the property
CdoPR_ATTACH_DATA_BIN but we could not read the attachment data if it is a
.MSG attachment. So Could you please let us know how to basically read the
attachment data and we have to convert this to XML as highlighted in the red
above?
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Kiruthika R" <Kiruthika R...@discussions.microsoft.com> wrote in message
news:ED208836-C65D-4530...@microsoft.com...