2013-06-22 57 views
1

我試圖用相同的帳戶取消經常性的情況,我使用此創建了此定期約會。我得到這個錯誤:EWS:取消經常性約會

User must be an organizer for CancelCalendarItem action 

當我檢查約會的性質,我覺得組織者具有相同的SMTP地址由服務所使用的一個。錯誤沒有意義。

我是否需要模擬資源(空間)電子郵件才能取消會議?

我試圖取消一系列約會的單一事件。訂房代碼:

Appointment appointment = new Appointment(service); 

      appointment.Subject = Subject; 
      appointment.Body = Body; 
      appointment.Start = Start; 

      foreach (DataRow room in Rooms.Rows) 
      { 
       appointment.Resources.Add(room["Email"].ToString()); 
      } 
if (Recurring) 
      { 
       DayOfTheWeek[] days = new DayOfTheWeek[] { (DayOfTheWeek)Start.DayOfWeek }; 
       appointment.Recurrence = new Recurrence.WeeklyPattern(Start.Date, 1, days); 
       appointment.Recurrence.StartDate = Start; 
       appointment.Recurrence.NumberOfOccurrences = RecurringOccurances; 
      } 
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy); 

獲得定期約會:

public static DataTable GetRecurringItems(String ID) 
     {  
      Appointment recurringMasterItem = Appointment.BindToRecurringMaster(service, new ItemId(ID)); 
      DataTable RecurringAppoitnments = new DataTable(); 
      int Occs = recurringMasterItem.Recurrence.NumberOfOccurrences.Value; 
      for (int i = 1; i <= Occs; i++) 
      { 
       Appointment occurrenceOrException2 = Appointment.BindToOccurrence(service, new ItemId(recurringMasterItem.Id.UniqueId), i); 
       RecurringAppoitnments.Rows.Add(occurrenceOrException2); 

      } 

      return RecurringAppoitnments; 
     } 

//然後我選擇了重複出現的1以上取消:

Appointment appointment = Appointment.Bind(service, new ItemId(EWSID)); 
appointment.CancelMeeting(); 

我得到了「用戶必須是一個CancelCalendarItem動作的組織者「,當我嘗試取消會議時,儘管上面的所有操作都使用相同的用戶/帳戶創建。

+0

顯示一些代碼。什麼是'取消重複發生',你是否想要刪除一個重複事件? –

+0

@JanDoggen:謝謝你的提示,我剛更新了這個問題。 – Morano88

回答

0

嘗試模擬用戶取消會議。還要確保該ID具有足夠的權限來執行此操作。