更改 Outlook 附件指向的文件

Change what file an Outlook attachment points to

例如,我有一个 word 文档作为 Outlook 附件。我想要一个 C# 程序来找到该文件的本地位置,将其处理成 PDF,然后将电子邮件的附件更改为新的 PDF 文件。下次打开该附件时,它将打开 PDF 而不是 word 文档。

编辑 1:电子邮件附件在我的收件箱中,因为有人已将此文件发送给我。我能够像编辑任何其他文档一样编辑实际的 word 文件。我想这可以通过添加

这个功能可以吗?并重新收到对现有已收到电子邮件的评论。

是的,这是可能的。您可以开发 Outlook COM 加载项(例如,基于 VSTO 的加载项)。 Attachment class 提供 SaveAsFile method which saves the attachment to the specified path. Then you can automate Word where you may open the file just saved and re-save it using the .pdf file format. Or you may consider using third-party components that don't require Word installed on the system. After converting the document and getting the required pdf file you may remove an old attachment and re-add a new one. The Attachments.Add 在 Attachments 集合中创建新附件。

您可能会发现以下文章有帮助: