发布于 2020-05-05 14:36:39
使用哪个Office文件并不重要(它们属于哪个Office版本)--您仍然可以从.Net应用程序中自动化Office应用程序。因此,只需将COM引用(针对)添加到应用程序中,并使用以下代码:
using System;
using System.Runtime.InteropServices;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
namespace FileOrganizer
{
class Program
{
private void CreateMailItem()
{
Outlook.Application app = new Outlook.Application();
Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = "This is the subject";
mailItem.To = "someone@example.com";
mailItem.Body = "This is the message.";
mailItem.Display(false);
}
}
}https://stackoverflow.com/questions/61607144
复制相似问题