20160330001 调用及触发Office Outlook 约会

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Outlook = Microsoft.Office.Interop.Outlook;

namespace wx_base
{
    public partial class Frm_T1 : Form
    {

        public Frm_T1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // dll 调用 Microsoft.Office.Interop.Outlook (注意不同的Office 版本)

            // http://blog.sina.com.cn/s/blog_69c72c7c0101kkwe.html
            // http://www.tulaoshi.com/n/20160219/1603005.html
            // https://www.baidu.com/s?wd=C%23%20Office%20Outlook%20%E7%BA%A6%E4%BC%9A&pn=30&oq=C%23%20Office%20Outlook%20%E7%BA%A6%E4%BC%9A&tn=monline_3_dg&ie=utf-8&rsv_idx=1&rsv_pq=ad2cdabd000dd6cd&rsv_t=7866XcCJw92Dm6hipr3OdaCDvKep2NcCDjpjbsyujR%2FSstifP92iaNfHnUj1aeDcZp8I&rsv_page=1
            // C# Office Outlook 约会

            // https://msdn.microsoft.com/zh-cn/ff869762

            //
            CreateAppointment(System.Convert.ToDateTime("2016-03-29 15:25:26"), System.Convert.ToDateTime("2016-03-29 18:28:26"), 10, "标题", "测试内容");

        }

        #region  约会.


        ///
        /// 创建约会.
        ///
        /// 开始时间
        /// 结束时间
        /// 提前多长时间提醒
        /// 标题
        /// 内容
        public void CreateAppointment(
            DateTime satrtDateTime,
            DateTime endDateTime,
            int reminderMinutesBeforeStart,
            string subject,
            string body
            )
        {
            // 创建约会.

            //Outlook.AppointmentItem outLookAppointmentItem = (Outlook.AppointmentItem)
            //outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);


            // Outlook.ApplicationClass oApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
            //会议是约会的一种
            //Outlook.AppointmentItem oItem = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
            //oItem.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;


            // 创建 OUTLOOK APP
            Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
            Outlook.AppointmentItem outLookAppointmentItem =
                (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);

            // 开始时间
            outLookAppointmentItem.Start = satrtDateTime;
            // 结束时间
            outLookAppointmentItem.End = endDateTime;

            // 提前多长时间提醒
            outLookAppointmentItem.ReminderMinutesBeforeStart = reminderMinutesBeforeStart;
            // 标题
            outLookAppointmentItem.Subject = subject;
            // 内容
            outLookAppointmentItem.Body = body;

            // 保存.
            outLookAppointmentItem.Save();

        }


        #endregion
        //
    }
}

原文地址:https://www.cnblogs.com/hutie1980/p/5338001.html