Search code examples
c#oauth-2.0google-apigoogle-calendar-api

Error 404: while deleting Calendar Event


I am getting following Error while deleting Event......

Google.Apis.Requests.RequestError

Not Found [404]

Here is the code:

public static string delete(CalendarService service, string id)
{`enter code here`
    try
    {
        //id = ja7jihu9eepa2l7h15d1vusf19
        return service.Calendars.Delete(id).Execute();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        return null;
    }
}

Can Anybody suggest me?


Solution

  • To delete an event, you need to call Events.Delete() providing both, calendar ID and event ID. A calendar ID is an email address of the calendar while the event ID is an alphanumeric event identifier (like the one you have commented out).

    https://developers.google.com/google-apps/calendar/v3/reference/events/delete