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

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

问题描述

我正在尝试使用以下代码在另一个人的 Microsoft Outlook (2003) 日历中创建约会.运行此程序时,约会正在我的日历中保存.但没有发送给收件人.

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天全站免登陆