如何使用c#将时间表添加到outlook中 [英] How to add schedule into the outlook using c#
本文介绍了如何使用c#将时间表添加到outlook中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用c#将时间表添加到Outlook中?
请帮帮我。
解决方案
你好AnkitKumar2016,
根据你在C#论坛上的最后一个帖子,我觉得你想要的是添加预约,对吗?
以下是Windows窗体项目中的一些简单代码,您可以尝试根据需要进行调整。
private void btnCreateAppointment_Click(object sender,EventArgs e)
{
//使用Outlook = Microsoft.Office.Interop.Outlook添加对Microsoft.Office.Interop.Outlook
//的引用
//创建Outlook应用程序
Outlook.Application application = new Outlook.Application();
//创建新约会
Outlook.AppointmentItem appointmentItem = application.CreateItem(Outlook.OlItemType.olAppointmentItem);
//设置约会的内容
appointmentItem.Subject ="这是一个预约测试" ;;
appointmentItem.Body ="这是约会的内容" ;;
appointmentItem.Location ="此约会将在此处保留";
appointmentItem.Start = DateTime.Now;
appointmentItem.End = DateTime.Now.AddMinutes(30);
appointmentItem.Save();
}最好的问候,
Terry
How to add schedule into the outlook using c#??
Please help me.
解决方案
Hi AnkitKumar2016,
According to your last thread in C# forum, I think what you want is to add an appointment, right?
Here is some simply code in a Windows Form project, you could try to adjust it for your need.
private void btnCreateAppointment_Click(object sender, EventArgs e) { //add reference to Microsoft.Office.Interop.Outlook //using Outlook = Microsoft.Office.Interop.Outlook; //create an outlook application Outlook.Application application = new Outlook.Application(); //create a new appointment Outlook.AppointmentItem appointmentItem = application.CreateItem(Outlook.OlItemType.olAppointmentItem); //set content of the appointment appointmentItem.Subject = "This is an appointment for testing"; appointmentItem.Body = "This is the content of the appointment"; appointmentItem.Location = "This appointment will be hold in here"; appointmentItem.Start = DateTime.Now; appointmentItem.End = DateTime.Now.AddMinutes(30); appointmentItem.Save(); }Best Regards,
Terry
这篇关于如何使用c#将时间表添加到outlook中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文