2013-04-09 41 views
0

下面是修改和刪除重複會議發生的鏈接。如何使用c#從EWS獲得經常性會議的發生次數?

http://msdn.microsoft.com/en-us/library/exchange/dd633618(v=exchg.80).aspx

我的問題是我們如何能夠從EWS得到的發生數量或者是有沒有辦法找到它。

Appointment occurrence = Appointment.BindToOccurrence(service, new ItemId(sRecurringMasterId), 3); 

在上面的代碼,他們有硬編碼的發生數爲3,但我怎麼能動態地得到這個信息?

回答

0

有沒有直接的方法,我做的是以下幾點:

  1. 獲得任命其爲RecurringMaster。
  2. 定義起始和結束時間復發,如果沒有 結束時間,喜歡它將會永存,然後我定義了一個天數 的,我會搜索內
  3. 基於先前時序
  4. 查找appontments
  5. 過濾結果基於類型AppointmentType.Occurrence和 算你有什麼

下面的代碼說明上面我所編寫。

var occurrencesCounter = 0; 
if (appointment.AppointmentType == AppointmentType.RecurringMaster) 
{ 
    appointments = ppointment.Service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(appointment.Start, (appointment.Recurrence.EndDate == null ? DateTime.Today.AddDays(7) : (DateTime)appointment.Recurrence.EndDate))); 
    foreach (var apt in appointments) 
    { 
     if (apt.AppointmentType == AppointmentType.Occurrence) 
     { 
      occurrencesCounter++; 
     } 
    } 
} 
相關問題