【发布时间】:2013-08-16 05:56:44
【问题描述】:
我正在开发一个 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 约会。
请指出正确的方向,即使我需要使用不同的方法。
提前致谢。
【问题讨论】:
-
您服务器上的代码无法访问客户端计算机上的 Outlook。您需要做的是创建一个 VCS 文件,允许客户端下载它,如果他们的机器设置正确,Outlook 将启动并创建约会。