Search code examples
c#google-apigoogle-calendar-apigoogle-api-dotnet-client

Get Calendar ID of Event in Google Calendar API C#


Is there a way to get the Calendar ID of an event in Google Calendar through the Event class?

        var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
        new ClientSecrets
        {
            ClientId = "1079676878296-hga8cb7jgk2lmprishaiiul8vkutu33b.apps.googleusercontent.com",
            ClientSecret = "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",
        },
        new[] { CalendarService.Scope.Calendar },
        CalendarAccount,
        CancellationToken.None).Result;

        var service = new CalendarService(new BaseClientService.Initializer
        {
            HttpClientInitializer = credential,
            ApplicationName = "Custom CRM",
        });

        var recurringEvent = service.Events.Get(eventid);

        recurringEvent.Execute().Summary

Like where I can do recurringEvent.Execute().Summary,
Is there a way to do recurringEvent.Execute().CalendarID?


Solution

  • The execute method returns the event object.

    var result = recurringEvent.Execute();
    result.Id