如何创建和发送约会到Microsoft Outlook日历? [英] How do I create and send appointments to Microsoft Outlook calender?

查看:323
本文介绍了如何创建和发送约会到Microsoft Outlook日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建在Microsoft Outlook中(2003年)预约使用他人的日历下面code.While运行这个程序,该任命是得到保存在我的calender.But不被发送给收件人

I am trying to create an appointment in the Microsoft Outlook (2003) calender of another person using the below code.While running this program, The Appointment is getting saved in my calender.But not being sent to the recipient.

try
{
    Microsoft.Office.Interop.Outlook.Application app = null;
    Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;

    app = new Microsoft.Office.Interop.Outlook.Application();

    appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
        .CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
    appt.Subject = "Meeting ";
    appt.Body = "Test Appointment body";
    appt.Location = "TBD";
    appt.Start = Convert.ToDateTime("12/23/2009 05:00:00 PM");
    appt.Recipients.Add("smuthumari@mycompany.com");
    appt.End = Convert.ToDateTime("12/23/2009 6:00:00 PM");
    appt.ReminderSet = true;
    appt.ReminderMinutesBeforeStart = 15;
    appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
    appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
    appt.Save();
    appt.Send();
}
catch (COMException ex)
{
    Response.Write(ex.ToString());
}

我缺少什么?任何一个可以帮助我解决这个问题呢?

Am i missing anything? Can any one help me out to solve this issue?

推荐答案

在你的约会:

Outlook.MailItem mailItem = appt.ForwardAsVcal();
mailItem.To = "recipient's email address";
mailItem.Send();

这篇关于如何创建和发送约会到Microsoft Outlook日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆