Problem with deleting attachments from mailitems attachment-collection using OOM 2000

Problem with deleting attachments from mailitems attachment-collection using OOM 2000

Post by Dariu » Sat, 28 Oct 2006 00:08:59


Hi,

I've written a COM-AddIn for Outlook using VC+ and OOM.

One of the functionality is to store emails as msg-file to disk without
any attachments.

<snip:>
...
Outlook::AttachmentsPtr pAttachments = m_pMailItem->Attachments;

lCount = pAttachments->Count;

for(lCount; lCount > 0; lCount--)
{
Outlook::AttachmentPtr pAttachment = pAttachments->Item(lCount);
if(CONDITION)
{
pAttachments->Remove(lCount);
}
}
}
...

m_pMailItem->SaveAs(strFilename, Outlook::olMSG);

...
</snip:>

In Oulook 2002 and 2003 this code works fine and I'm getting my expected
msg-file without the deleted attachments before. But in Outlook2000
the stored msg-file contains all attachments anymore.


Any idea?

Best regards
Darius
 
 
 

Problem with deleting attachments from mailitems attachment-collection using OOM 2000

Post by Ken Slovak » Sat, 28 Oct 2006 02:31:16

Try getting each Attachment object and calling its own Delete method.

--
Ken Slovak
[MVP - Outlook]
http://www.yqcomputer.com/
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.yqcomputer.com/

 
 
 

Problem with deleting attachments from mailitems attachment-collection using OOM 2000

Post by Dariu » Sat, 04 Nov 2006 21:17:54

Ken Slovak - [MVP - Outlook] schrieb:
That was the solution.
Thanks a lot.
Darius Biss