Error saving attachments when they are embedded

后端 未结 2 624
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 02:22

I\'m saving Outlook attachments (as part of a copy).

I get an error message from the line objAtt.SaveAsFile strFile when the attachment is an embedded image

2条回答
  •  余生分开走
    2021-01-29 02:53

    Is that an RTF message? RTF messages embed images and objects (such as Excel spreadsheets) not as files, but as OLE objects, and Attachment.SaveAsFile will fail for the OLE attachments. If you want to filter out attachments like that, make sure you either skip attachments with the Attachment.Type = olOLE (6) or only deal with the attachments of type olByValue or olEmbeddeditem.

    If you still need to save OLE attachments, you can use Redemption - its RDOAttachment.SaveAsFile method will extract the file data from most common OLE attachments (such Word docs, PDF files, Excel spreadsheets, images, etc.)

提交回复
热议问题