2016-09-27 52 views
0

我無法找到如何使用針對C#的Exchange Web服務託管API獲取一系列私人約會的主發生次數。爲私人約會獲取主發生次數

當我使用ExchangeService上的FindAppointments檢索約會列表時,我設法在搜索條件中找到事件。但是,當我然後嘗試使用Appointment.BindToRecurringMaster獲取定期主約會,其中id是專用事件的ID時,出現錯誤「未找到指定的對象,未找到該項目。」

是否有任何其他方式可以讓我爲私人事件檢索主事件?

在我下面的示例中,我使用作爲目標郵箱日曆上的審閱者權限的服務帳戶進行身份驗證。

var exchangeService = new ExchangeService(); 
exchangeService.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx"); 
exchangeService.Credentials = new WebCredentials("[email protected]", "password", "domain"); 

const string email = "[email protected]"; 

// The following successfully retrieve all appointments including the private occurrence. 
var appointments = exchangeService.FindAppointments(
    new FolderId(WellKnownFolderName.Calendar, new Mailbox(email)), 
    new CalendarView(DateTime.UtcNow, DateTime.UtcNow.AddDays(1))); 

const string id = "AAMkA..."; // Id of the private occurrence. 
// The following fails saying "The specified object was not found in the store., Item not found." 
var appointment = Appointment.BindToRecurringMaster(exchangeService, id); 

任何幫助表示讚賞。

+0

http://stackoverflow.com/questions/22464784/how-to-get-the-recurring-master-of-all-recurring-series-that-have-one-or-more-oc可能類似這樣 – KulOmkar

回答