Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Problem with deleting attachments from mailitems attachment-collectionusing OOM 2000 (http://www.outlookbanter.com/add-ins-outlook/31167-problem-deleting-attachments-mailitems-attachment.html)

Darius October 26th 06 04:08 PM

Problem with deleting attachments from mailitems attachment-collectionusing OOM 2000
 
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

Ken Slovak - [MVP - Outlook] October 26th 06 06:31 PM

Problem with deleting attachments from mailitems attachment-collection using OOM 2000
 
Try getting each Attachment object and calling its own Delete method.

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


"Darius" wrote in message
...
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



Darius November 3rd 06 12:17 PM

Problem with deleting attachments from mailitems attachment-collectionusing OOM 2000
 
Ken Slovak - [MVP - Outlook] schrieb:
Try getting each Attachment object and calling its own Delete method.

That was the solution.
Thanks a lot.
Darius Biss


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com