Deleting Attachments

D

Dan Cernoch

here is the code....

while(olMail.Attachments.Count != 0)
{
Outlook.Attachment olAtt = (Outlook.Attachment) ->cont.
olMail.Attachments[1];
Console.WriteLine(olAtt.FileName);
olAtt.Delete();
}
here is what happens.
All FileNames are printed to screen
No Attachments are deleted.

Thoughts?
Thanks,
Dan
 
S

Sue Mosher [MVP-Outlook]

Doesn't look like you're saving the item after you delete the attachments.
 
D

Dan Cernoch

THANK YOU SO MUCH!
-----Original Message-----
Doesn't look like you're saving the item after you delete the attachments.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Dan Cernoch said:
here is the code....

while(olMail.Attachments.Count != 0)
{
Outlook.Attachment olAtt = (Outlook.Attachment) - cont.
olMail.Attachments[1];
Console.WriteLine(olAtt.FileName);
olAtt.Delete();
}
here is what happens.
All FileNames are printed to screen
No Attachments are deleted.

Thoughts?
Thanks,
Dan


.
 
Top