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("[email protected]", 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With