title: Is it possible to cancel an event using Microsoft Graph?
body: <p>I'm trying to write a simple api in C# that will be used to, among other things, delete events from a user's calendar using the Graph api.</p>
  
  <p>The problem I've run into is that I can't delete events that need to be canceled, obviously because they need to be canceled. However, I can't figure out how to write a function to actually CANCEL these events. I'm currently using <a href="https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/event_cancel" rel="nofollow noreferrer">https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/event_cancel</a> to try and cancel an event, and I'm getting a success status code... but nothing happens. The event isn't canceled, and it isn't removed from my calendar.</p>
  
  <p>Any suggestions or advice are greatly appreciated. My code for canceling an event is below.</p>
  
  <pre><code>   public async void CancelAppointment(string eventId)
      {
          try
          {
              var client = GetHttpClient();
              Uri targetEndpoint = new Uri("https://graph.microsoft.com/beta/me/events/" + eventId + "/cancel");
              string postBody = "{" +
                                "\"Comment\": \"Appointment canceled.\"" +
                                "}";
              var body = new StringContent(postBody, System.Text.Encoding.UTF8, "application/json");
  
              var response = await client.PostAsync(targetEndpoint, body);
              Console.WriteLine(response.StatusCode);
  
              if (response.IsSuccessStatusCode)
              {
                  Console.WriteLine("Canceled appointment with Id: " + eventId);
              }
          }
          catch (Exception e)
          {
              Console.WriteLine("Could not cancel appointment " + eventId + " " + e.Message);
          }
      }
  </code></pre>