2012-08-06 81 views
2

即时通讯在用户日历中插入约会, 我可以用我自己的方式轻松插入使用Microsoft.Office.Interop.Outlook.Application(下), 然后添加用户作为收件人,但如果我不想添加自己,如果我只想添加其他人,该怎么办?这可以用类似的方式完成吗?使用c#插入outlook预约,asp.net

感谢

  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("[email protected]"); 
      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(); 
+0

你有没有在Outlook中试过这个?我相信您在创建约会时会自动成为与会者。你不会在Outlook中有一个选项来删除你的名字。如果Outlook不允许,Interop将不会有任何选项。 – 2012-08-06 12:04:25

回答

6

你不能(或不应该)使用Outlook API从ASP.NET应用程序。相反,Exchange Server提供了一个Web Services SDK,它允许您与Exchange Server进行交互。该文件有如何to create appointments in a user's mailbox的样本。

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

EWS在Exchange 2007中首次引入。对于较早版本的Exchange,可以使用协作数据对象(CDO)。 Exchange 2003 SDK包含有关如何create appointments and meeting requests的文档。

+0

谢谢,我会研究这个,听起来更像我需要的 – DarkW1nter 2012-08-06 12:08:15

+0

嗨,应该指出,我们目前运行Exchange 2003,似乎无法找到2003年的Web服务DLL,有没有这样的事情?? – DarkW1nter 2012-08-06 13:42:40