如何将Outlook邮件保存为.msg文件与类别和其他详细信息? [英] How to save Outlook mails as .msg file with categories and other details?

查看:1488
本文介绍了如何将Outlook邮件保存为.msg文件与类别和其他详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MailItem.SaveAs在Outlook VBA中保存电子邮件很容易



但是我没有看到任何保存附加细节的选项,例如作者和类别。



第三方程序MessageSave允许以.msg格式保存类别和作者的邮件。在Windows资源管理器中,作者和类别列显示与Outlook中相同的信息。



有人知道如何使用Outlook VBA保存邮件,包括这些附加信息? / strong>



我买了MessageSave,这是一个很好的程序,但是他们不允许在VBA中使用它们的保存功能。唯一的解决方法是让消息保存消息在到达特定文件夹时。如果需要,我可以使用这个功能,但这只是一个解决方法。



以下是Windows资源管理器中显示的使用MessageSave保存的电子邮件的示例:

解决方案

这是一个我遵循的过程:(win7 64)



windows vba设置扩展文件属性



首次点击: StackOverfow 16989882



web search:DSOFile.OleDocumentProperties p>

点击微软:当您没有安装Office时,Dsofile.dll文件可以让您编辑Office文档属性



< a href =https://support.microsoft.com/en-us/help/224351/the-dsofile.dll-files-lets-you-edit-office-document-properties-when-yo =nofollow noreferrer> HTTPS :/support/support
$ b

这不是一个错字...它以when-yo结尾



下载:DsoFileSetup_KB224351_x86.exe



打开DsoFileSetup_KB224351_x86.exe,使用7-zip程序(从7-zip.org)



从DsoFileSetup_KB224351_x86.exe复制dsofile.dll (使用7-zip)到一个文件夹桌面(在这个例子中命名为testFiles)(这可能是任何地方...也许Windows system32或syswow64 ...我只在桌面上尝试)



以管理员身份打开命令提示符窗口



导航到包含dsofile.dll的文件夹



执行以下命令:regsvr32 dsofile.dll



应该收到成功确认



start outlook ... vba editor .. 。工具...参考



并找到DSO OLE文档属性读者2.1,并选中左侧的框



返回vba编辑器...创建新模块



粘贴到以下内容(这只是一个最小的测试脚本)

  Sub extendedProperties()

Dim objFile As OleDocumentProperties
Set objFile = CreateObject(DSOFile.OleDocumentProperties)

objFile 。打开(C:\Users\js\Desktop\testFiles\myMessage.msg)'调整以匹配您的系统
objFile.SummaryProperties.Subject =我的主题
objFile 。

设置objFile =无(拖放)一个电子邮件myMessage从outlook到文件夹(在这个例子中的桌面上)



右键单击文件夹列标题...点击更多。 ..找到主题...
点击复选框



运行脚本



主题列应包含myMessage.msg旁边的我的主题(或任何你的消息被命名)



可能有一个更简单的方法...也许windo ws PowerShell有一个命令可以从vba调用

It is easy to save emails in Outlook VBA with MailItem.SaveAs

But I don't see any option to save additional details like i.e. the Author and Categories.

The 3rd party program MessageSave allows to save mails with Categories and Author in .msg format. In Windows Explorer the columns Author and Categories show the same information like in Outlook.

Does anybody know how to save messages using Outlook VBA including these additional information?

I bought MessageSave and it's a good program but they don't allow their save function to be used in VBA. The only workaround is to let MessageSave save messages when they "arrive" in a specific folder. If necessary I can use this function but this is just a workaround.

Here is a sample how the emails saved with MessageSave are shown in Windows Explorer:

解决方案

here is a process i followed: (win7 64)

web search "windows vba set extended file property"

first hit: StackOverfow 16989882

web search: "DSOFile.OleDocumentProperties"

hit microsoft: The Dsofile.dll files lets you edit Office document properties when you do not have Office installed

https://support.microsoft.com/en-us/help/224351/the-dsofile.dll-files-lets-you-edit-office-document-properties-when-yo

that is not a typo ... it ends in "when-yo"

download: DsoFileSetup_KB224351_x86.exe

open DsoFileSetup_KB224351_x86.exe using 7-zip program (from 7-zip.org)

copy dsofile.dll from DsoFileSetup_KB224351_x86.exe (using 7-zip) into a folder desktop (named "testFiles" in this example) (this could be anywhere ... maybe windows system32 or syswow64 ... i only tried on desktop )

open command prompt window as administrator

navigate to folder that contains dsofile.dll

execute following: regsvr32 dsofile.dll

should receive success confirmation

start outlook ... vba editor ... tools ... references

and find "DSO OLE Document Properties Reader 2.1" and check the box on left

back to vba editor ... create new module

paste in the following: (this is just a minimal test script)

Sub extendedProperties()

    Dim objFile As OleDocumentProperties
    Set objFile = CreateObject("DSOFile.OleDocumentProperties")

    objFile.Open ("C:\Users\js\Desktop\testFiles\myMessage.msg")  ' adjust to match your system
    objFile.SummaryProperties.Subject = "My Subject"
    objFile.Save

    Set objFile = Nothing
End Sub

copy (drag&drop) an email "myMessage" from outlook to folder (on desktop in this example)

right-click on folder column header ... click on more ... find "subject" ... click checkbox

ran script

subject column should contain "My Subject" next to myMessage.msg (or whatever your message is named)

there may be a simpler way ... maybe windows PowerShell has a command that could be called from vba

这篇关于如何将Outlook邮件保存为.msg文件与类别和其他详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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