2012-06-20 123 views
0

我正在嘗試創建一個Outlook預約,直接進入用戶日曆,並將回覆轉到其他電子郵件地址。展望預約c#

這是可能使用和LDAP查詢嗎?如果不是,我最好的選擇是什麼?

感謝 SP

回答

0
public void addAppointments(String subject,String body,DateTime startTime,DateTime endTime,String location) 
{ 
    Appointment app = new Appointment(_service); 
    app.Subject = subject; 
    app.Body = body; 
    app.Start = startTime; 
    app.End = endTime; 
    app.Location = location; 

    //DayOfTheWeek[] days = new DayOfTheWeek[] { DayOfTheWeek.Saturday }; 
    //app.Recurrence = new Recurrence.WeeklyPattern(app.Start.Date, 1, days); 
    //app.Recurrence.StartDate = app.Start.Date; 
    //app.Recurrence.NumberOfOccurrences = 3; 

    app.Save(); 
} 

這種方法可以用來添加預約。使用Outlook API。

此鏈接也有幫助。

http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/7ae6d938-a64f-4c27-95ba-435f84da236f

0

據我知道你不能做到這一點使用LDAP。您可能想要掌握Exchange Web Services程序集(Microsoft.Exchange.WebServices),它包裝交換服​​務器Web服務API並允許您輕鬆地「交換」。

例如示例代碼來獲得任命:

var service = new ExchangeService { UseDefaultCredentials = true }; 
service.AutodiscoverUrl(emailAddress); 

// Set the calendar view to use 
var view = new CalendarView(startDate, endDate); 

// Get the target folder ID using the email address 
var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(emailAddress)); 

// Get the appointments 
var response = service.FindAppointments(folder, view); 

編輯:

並創建一個 - (使用一些上面的代碼來獲得服務實例):

var apt = new Appointment(service); 
apt.Start = DateTime.Now; 
// Do other stuff 
apt.Save();