保存“设备无关位图"附件 [英] Saving "Device Independent Bitmap" attachment

查看:75
本文介绍了保存“设备无关位图"附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确保存这种附件(来自签名邮件)?我用 .SaveAsFile 方法保存了它,但它没有任何扩展名,也没有应用程序可以打开它.

How to properly save this kind of attachment (from signed message)? I saved this with .SaveAsFile method, but it is without any extension and no application can open it.

Set OutItem = Application.ActiveExplorer.Selection.Item(1)

For Each att In OutItem.Attachments
    att.SaveAsFile "C:\Temp\" & att.DisplayName
Next

推荐答案

对于 olOlE 附件,您需要将附件作为 IStorage COM 对象打开并从其中的一个流中提取数据(可以被破坏)存储 - 您可以在 OutlookSpy 中查看数据:选择邮件,单击 OutlookSpy 功能区上的 IMessage 按钮,转到 GetAttachmentTable 选项卡,双击其中一个附件.选择 PR)_ATTACH_DATA_OBJ 属性,右击,IMAPIProp::OpenProperty,选择 IID_IStorage.无法使用 Outlook 对象模型在 VBA 中访问数据

For the olOlE attachments, you would need to open the attachment as an IStorage COM object and extract the data (which can be mangled) from one of the streams inside the storage - you can see the data in OutlookSpy: select the message, click IMessage button on the OutlookSpy ribbon, go to the GetAttachmentTable tab, double click on one of the attachments. Select the PR)_ATTACH_DATA_OBJ property, right click, IMAPIProp::OpenProperty, select IID_IStorage. The data cannot be accessed in VBA using the Outlook Object Model

如果使用 Redemption 是一种选择,则其 RDOAttachment.SaveAsFile 方法足够智能,可以从存储中提取 BMP、EMF、PDF、Excel 等文件数据.类似于以下内容(在我的脑海中)应该可以完成这项工作:

If using Redemption is an option, its RDOAttachment.SaveAsFile method is smart enough to extract BMP, EMF, PDF, Excel, etc. file data from the storage. Something like the following (off the top of my head) should do the job:

  set Session = CreateObject("Redemption.RDOSession")
  Session.MAPIOBJECT = Application.Session.MAPIOBJECT
  set rMsg = Session.GetRDOObjectFromOutlookObject(Application.ActiveExplorer.Selection.Item(1))
  For Each att In rMsg.Attachments
    att.SaveAsFile "C:\Temp\" & att.FileName
  Next

这篇关于保存“设备无关位图"附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆