简体   繁体   中英

Set the Color of a Google Calendar event with the API in C#

i have a question regarding the Google Calendar API with C#. I want to set the color of an specific event but whatever i add to the ColorId property, it does not affect my event after updating.

Here ist my code:

 Event data = CalendarService.Events.Get("primary", id).Execute();
 data.Description = _GetDescription(done, notes, uniqueLinkId);

 Colors colors = CalendarService.Colors.Get().Execute();
 if (colors != null && colors.Calendar != null)
 {
      var color = colors.Calendar.FirstOrDefault(x => x.Value.Background == "#16a765");
      if (!string.IsNullOrWhiteSpace(color.Key))
      {
                data.ColorId = color.Key;
      }
 }

 var request = CalendarService.Events.Update(data, "primary", id);
 request.SupportsAttachments = true;
 request.SendNotifications = false;

 request.Execute();

Any ideas on how this doesn't work?

Regards, Andreas

Looks like its might be a bug CalendarList background color change is not working (.NET)

The only issue with this is that i have not been able to get it to set using the Google APIs exporer either. which makes me wonder if this is something they removed after the release of the new Google calendar.

I have sent off an email to Google but i dont have a direct contact on that team it make be a while before i hear anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM