I'm trying to cancel a recurring occurrence with the same account I created this recurring appointment with. I'm getting this error :
User must be an organizer for CancelCalendarItem action
When I check the properties of the appointment, I find that the organizer has the same SMTP address as the one used by the service. The error doesn't make sense.
Do I need to impersonate the resource (room) email to be able to cancel the meeting?
I'm trying to cancel a single occurrence of a series of appointments. Booking Code:
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);
Getting Recurring Appointments :
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;
}
//Then I chose 1 of the recurring occurrences above to cancel it :
Appointment appointment = Appointment.Bind(service, new ItemId(EWSID));
appointment.CancelMeeting();
I get the "User must be an organizer for CancelCalendarItem action" when I try to cancel the meeting although all the actions above created using the same user/account.