CreateItemFromTemplate() losing Attachments

"Excel VBA Help"


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Microsoft Topics > Microsoft Outlook Forum
Our Info Pages:-
The Code Cage - Microsoft Office help


Microsoft Outlook Forum Members, post questions in this forum if they are related to using Microsoft Outlook, this includes Mail, Calendars, Forms & Macro's etc.

New Reply
Thread Tools Rate Thread Display Modes
Unread 1st February 2010, 15:38
xadeqd's Avatar
Newsgroup Contributor
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default CreateItemFromTemplate() losing Attachments
     Outlook: VBA   

------ Register to get rid of these "In Post" ads! ------

Category: Outlook: VBA   

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.

The Code Cage Advertisment
New Reply
The Code Cage at Facebookhe Code Cage at Twitter

attachments, createitemfromtemplate, losing

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

The Code Cage Affilliates tested by McAfee Security tested by McAfee Security

All times are GMT +1. The time now is 21:33.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
Cultural Forum | Study at Malaysian University