[英]Opening a new Outlook 2016 window with c#
使用哪個 Office 互操作文件(它們屬於哪個 Office 版本)並不重要 - 您仍然可以從 .Net 應用程序自動化 Office 應用程序。 因此,只需將 COM 參考(用於 Microsoft Office Outlook)添加到您的應用程序並使用以下代碼:
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);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.