简体   繁体   English

如何在用户日历中保存Outlook约会?

[英]How to save an outlook appointment in users calendar?

I am developing an asp.net web application which allows users to syn any Event from the gridView to there Outlook appointment using the following code: 我正在开发一个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();
        }

Code works fine when I run locally in visual studio localhost, but fails on server. 当我在Visual Studio本地主机中本地运行时,代码工作正常,但在服务器上失败。 Not sure logically would it be able to store an outlook appointment on client outlook since the code is running at server. 从逻辑上讲,由于代码在服务器上运行,因此不能在客户端Outlook上存储Outlook约会。

Please point me to right direction, even in case I need to use different approach. 即使在我需要使用其他方法的情况下,也请指出正确的方向。

Thanks in advance. 提前致谢。

Outlook, just like any other Office app, cannot be used in a service (such as IIS). 与其他Office应用程序一样,Outlook也不能在服务(例如IIS)中使用。 See How to access client's outlook in ASP.net? 请参阅如何在ASP.net中访问客户端的外观? for alternatives. 供选择。

I always did it as an email to the user. 我总是以电子邮件的形式发送给用户。 A lot of sites online have the required data that needs to be sent to convert an email to a meeting request, here's an example. 许多在线站点具有将电子邮件转换为会议请求所需的必需数据,这是一个示例。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM