CreateItemFromTemplate() losing Attachments

  • Thread starter Thread starter xadeqd
  • Start date Start date
X

xadeqd

This is very, very rare, but the Attachments collection is returning empty
for some '.msg' files that I am loading with CreateItemFromTemplate(). I have
a small set of emails from 2002 where it happens every time, but I do not
know why it happens with them. When I open the MSG with Outlook 2007 the
attachments are there and can be opened, and OutlookSpy also reports that the
Attachments collection is not empty.

Sample of code where this happens (C#):

using Outlook = Microsoft.Office.Interop.Outlook;
....
Outlook._Application outlookApp = new Outlook.ApplicationClass();
Outlook._MailItem mailItem =
(Outlook._MailItem)outlookApp.CreateItemFromTemplate(@"path to certain msg
with attachments", Type.Missing);
int count = mailItem.Attachments.Count; //Collection empty, count is 0

I spot-checked other properties such as subject, body, from/to, and
everything looks good except for the attachments. Subsequently using SaveAs()
to re-save the MSG to disk yields the original MSG without any attachments.

Any advice is appreciated, crossing my fingers for anything that may lead me
to a workaround.
 
Back
Top