【问题标题】:How do I create and send appointments to Microsoft Outlook calender?如何创建约会并将其发送到 Microsoft Outlook 日历?
【发布时间】:2010-12-29 11:11:22
【问题描述】:

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

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());
}

我错过了什么吗?谁能帮我解决这个问题?

【问题讨论】:

    标签: c# .net automation outlook-2003


    【解决方案1】:

    预约后:

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

    【讨论】:

      【解决方案2】:

      尝试添加:

      appt.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
      

      默认状态是我不确定是否正在发送的约会。

      【讨论】:

        【解决方案3】:

        这是我解决此问题的方法:

        我把(像桑尼男孩的帖子):

        Outlook.MailItem mailItem = appt.ForwardAsVcal();
        mailItem.To = "firstname.lastname@email.com";
        mailItem.Send();
        

        但我还必须创建一个 web.config 文件,并设置授权访问以避免任何 COMException:

        <system.web>
          <authorization>
            <deny users="?"/>
          </authorization>
        </system.web>
        

        【讨论】:

          猜你喜欢
          • 2019-01-26
          • 2018-04-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-12-29
          相关资源
          最近更新 更多