none
Delete an appointment in Exchange 2010 Shared Calendar Folder using Exchange Web Service RRS feed

  • Question

  • Hi,

    I had managed to create appointments from my C# web app using the exchange 2010 web service.

    Now I am trying to delete the appointments created and can't find any resource on the net.

    Any link to a sample or a simple tutorial would be appreciated.

    Below is my code to create the appointments.

     

     ExchangeService myService = new ExchangeService(ExchangeVersion.Exchange2010);
    
       myService.Credentials = new NetworkCredential("username", "password", "DOMAIN");
       myService.Url = new Uri("Https://serverl/Ews/exchange.asmx");
    
       System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
    
       Folder myPublicFoldersRoot = Folder.Bind(myService, WellKnownFolderName.PublicFoldersRoot);
       string myPublicFolderPath = "FolderName";
    
       FolderId fId = FindPublicFolder(myService, myPublicFoldersRoot.Id, myPublicFolderPath);
       CalendarFolder shareCalendar = CalendarFolder.Bind(myService, fId);
    
       Appointment Appt = new Appointment(myService);
       Appt.Subject = "Subject";
       Appt.Location = "FolderName";
       Appt.Start = Convert.ToDateTime(fromDate);
       Appt.End = Convert.ToDateTime(toDate);
       Appt.LegacyFreeBusyStatus = LegacyFreeBusyStatus.OOF;
       Appt.IsAllDayEvent = true;
        Appt.Categories.Add("Blue Category");
    
       Appt.Save(shareCalendar .Id, SendInvitationsMode.SendToNone);
    

     


    Zay Yar

    Zay Yar
    Thursday, March 24, 2011 3:32 AM

Answers

  • Try tp specifiy not to send updates when you delete it eg

    Delete(

    DeleteMode.SoftDelete, SendCancellationsMode.SendToNone);

    Cheers
    Glen

    • Marked as answer by zay yar Tuesday, March 29, 2011 5:55 AM
    Tuesday, March 29, 2011 5:45 AM

All replies

  • The first thing you need to do is if you want to delete an Item is find the Items you want to delete using a findItems operation and then you can use the delete method on the Item in question or call a batch deleteItems request give a collection of ItemIds you want to delete have a look at http://msdn.microsoft.com/en-us/library/dd637749%28v=exchg.80%29.aspx#Y1980 which has samples on searching as well as using the Delete method. Another really simple example given the sample you posted is you could delete that Item you just created using

     Appt.Delete(DeleteMode.SoftDelete);

    Cheers
    Glen

    Friday, March 25, 2011 2:25 AM
  • Thanks for the reply Glen.

    I get this exception message when I try to delete the appointment.

    "Meeting requests and cancellations can't be sent for calendar items located in public folders."

    My calendar folder is a public folder.

    Any idea? Is it because of the delete mode?


    Zay Yar
    Tuesday, March 29, 2011 3:52 AM
  • Try tp specifiy not to send updates when you delete it eg

    Delete(

    DeleteMode.SoftDelete, SendCancellationsMode.SendToNone);

    Cheers
    Glen

    • Marked as answer by zay yar Tuesday, March 29, 2011 5:55 AM
    Tuesday, March 29, 2011 5:45 AM
  • It works! Thanks Glen!

     

     


    Zay Yar
    Tuesday, March 29, 2011 5:55 AM