C#使用Outlook附件 [英] C# Working with Outlook Attachment
问题描述
您好,
有没有办法将MailItem的正文/内容保存为.txt文件,并将其添加到该MailItem的附件中。
感谢您的帮助
您好,
Body MailItem类返回 字符串 表示Outlook项目的明文正文。因此,您可以使用File.WriteAllText方法获取 字符串并将其保存到
a文本文件,请参阅
如何:写入文本文件(C#编程指南)以获取更多信息。然后你可以使用
Add Attachments类的方法(请参阅MailItem类的相应属性)以添加新附件。
Hello,
Is there any way to save the body/content of a MailItem as a .txt file and add it to the Attachments of that MailItem.
Thanks for the help
Hello,
The Body property of the MailItem class returns a String representing the clear-text body of the Outlook item. So, you can get the string and save it to a text file using the File.WriteAllText method, see How to: Write to a Text File (C# Programming Guide) for more information. Then you can use the Add method of the Attachments class (see the corresponding property of the MailItem class) to add a new attachment.
这篇关于C#使用Outlook附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!