2012-08-06 74 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