0

我正在开发一个 asp.net Web 应用程序,它允许用户使用以下代码将任何事件从 gridView 同步到 Outlook 约会:

private void generateOutlookAppointment(string subject, string location, string startDate, string endDate)
        {
            string body = "Test Data for Body.";


            Outlook.Application outlookApp = new Outlook.Application();
            Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);

            oAppointment.Subject = subject;
            oAppointment.Body = body ;

            oAppointment.Location = location;
            oAppointment.Start = DateTime.Parse(startDate).AddHours(9);
            oAppointment.End = DateTime.Parse(endDate).AddHours(9);
            oAppointment.ReminderSet = true; 
            oAppointment.ReminderMinutesBeforeStart = 15;
            oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; 
            oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;

            oAppointment.Save();
        }

当我在 Visual Studio localhost 中本地运行时,代码工作正常,但在服务器上失败。由于代码在服务器上运行,因此在逻辑上不确定是否能够在客户端 Outlook 上存储 Outlook 约会。

请指出我正确的方向,即使我需要使用不同的方法。

提前致谢。

4

2 回答 2

1

Outlook 与任何其他 Office 应用程序一样,不能在服务(如 IIS)中使用。请参阅如何在 ASP.net 中访问客户端的前景?为替代品。

于 2013-08-15T21:44:27.770 回答
0

我总是把它作为给用户的电子邮件。许多在线网站都需要发送将电子邮件转换为会议请求所需的数据,这是一个示例。

http://sahannet.blogspot.com/2010/09/create-outlook-vcalendar-reminder-file.html

于 2013-08-15T21:56:44.303 回答