使用 c#、asp.net 插入 Outlook 约会 [英] inserting outlook appointment using c#, asp.net

查看:30
本文介绍了使用 c#、asp.net 插入 Outlook 约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户日历中插入约会,我可以使用 Microsoft.Office.Interop.Outlook.Application(如下)轻松插入我自己的内容,然后将用户添加为收件人,但是如果我不想添加自己,如果我只想添加其他人呢?这可以用类似的方式完成吗?

Im looking to insert an appointment in a users calendar, I can easliy insert in my own using Microsoft.Office.Interop.Outlook.Application (below), then add the user as a recipient, but what if I dont want to add myself, if I only want to add others? Can this be done in a similar way?

谢谢

            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"; 
            appt.Location = "a room"; 
            appt.Start = Convert.ToDateTime("08/08/2012 05:00:00 PM"); 
            appt.Recipients.Add("a@b.com"); 
            appt.End = Convert.ToDateTime("08/08/2012 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();

推荐答案

您不能(或不应)从 ASP.NET 应用程序使用 Outlook API.相反,Exchange Server 提供了一个 Web 服务 SDK 允许您与 Exchange Server 进行交互.该文档有一个示例,说明如何在用户的邮箱.

You cannot (or should not) use the Outlook API from an ASP.NET application. Instead Exchange Server provides a Web Services SDK that allows you to interact with the Exchange Server. The documentation has a sample of how to create appointments in a user's mailbox.

您可能必须委派访问用于执行 ASP.NET 请求的用户帐户才能成功与 Exchange Server API 交互.

You may have to delegate access to the user account used to execute the ASP.NET request to succesfully be able to interact with the Exchange Server API.

EWS 最初是在 Exchange 2007 中引入的.对于旧版本的 Exchange,您可以使用协作数据对象 (CDO).Exchange 2003 SDK 包含有关如何创建约会的文档和会议请求.

EWS was first introduced in Exchange 2007. For older versions of Exchange you can use Collaboration Data Objects (CDO). The Exchange 2003 SDK contains documentation on how to create appointments and meeting requests.

这篇关于使用 c#、asp.net 插入 Outlook 约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆