Question

I want to delete Appointments via the EWS but it doesn't work. I have the following code:

private void deleteAppointment(object obj)
{
    ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
    service.Credentials = new WebCredentials(CredentialCache.DefaultNetworkCredentials);
    service.AutodiscoverUrl("user@place.com", RedirectionUrlValidationCallback);

    ItemId ii = (ItemId)obj;

    Appointment a = Appointment.Bind(service, ii);
    try
    {
        a.Delete(DeleteMode.MoveToDeletedItems);
    }
    catch (ServiceResponseException ex)
    {
        MessageBox.Show(ex.Message);
    }
}

The User that is logged in on the machine(me) is a Owner of the Calender from the user Address. But if I try to delete the Appointment the Exception is "Object cannot be deleted". The ItemId is correct. If I use the user Address as Credentials it works.

Was it helpful?

Solution

To use DeleteMode.MoveToDeletedItems, you need write access to the DeletedItems folder in addition to your access to the Calendar folder. If you don't want to add folder perms to the Deleted Items folder, you can use either DeleteMode.HardDelete or DeleteMode.SoftDelete.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top