1
votes

We have a problem deleting Appointments from Exchange using EWS.

I have Full Access for Room, which I'm able to cancel through outlook but not from our application.

Fetching Calendar Items:
Collection appointments = new Collection();

if (service != null)
{
    CalendarView calView = new CalendarView(fromDate, toDate);
    FindItemsResults<Item> masterResults = service.FindItems(WellKnownFolderName.Calendar, calView);
    masterResults.Items.ToList().ForEach(c =>
        {
            Appointment appointment = c as Appointment;
            appointment = Appointment.Bind(service, new ItemId(c.Id.UniqueId));
            appointments.Add(appointment);
        });
}

We select one appointment from above list and try to cancel that facing exception.

Cancel Appointment Code:

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

var cancelresult = appointment.CancelMeeting("The metting cancelled.");

we get an exception with the message "User must be an organizer for CancelCalendarItem action." This makes me really confused, because when I inspect the deletedAppointment object my email address is set as the organizer.

I have full access for room and able to cancel meeting from Outlook.

Can anyone help on this?

1

1 Answers

2
votes

If you want to cancel an appointment then you need to access the Calendar of the organiser, find that appointment and cancel that appointment. You can't use the copy of the appointment in the Room mailbox as its a different object and also it won't contain all the potential attendees that should get the cancellation message.