Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help related to outlook API

3 views
Skip to first unread message

R@discussions.microsoft.com Kiruthika R

unread,
Dec 21, 2009, 2:26:01 AM12/21/09
to
Hello Reader,

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

unread,
Dec 21, 2009, 4:41:59 PM12/21/09
to
Outlook does nto really sends MSG files, it converts them to embedded
messages - PR_ATTACH_DATA_BIN si simply not there.
On the MAPI level, you will need o open PR_ATTACH_DATA_DATA proeprty as
IMessage (IAttach::OpenProperty).
I have not used CDO 1.21 for a while, but wouldn't Attachment.Source return
the embedded message?

--
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...

0 new messages