Getting the colorId of events is returning null for set colors most of the time

426 views
Skip to first unread message

Jerri Kohl

unread,
Apr 12, 2021, 9:51:41 AM4/12/21
to Google Calendar API
I am using the Java API against a *private* primary calendar and when I call event.getColorId() it returns null for most, but not all, events with the colorId set to 5 (Banana). Even if I edit an  event which is returning null for the color and change the color, it will return null for certain colors, but not others. Even after selecting a color that returns the colorId, setting it back to 5 causes null to be returned.

My client's business revolves around color coded events in their calendar and there are *many* events that are already color coded 5 that need to be processed via my custom code. It is imperative that I be able to get the colorId of these events to be able to process them ASAP.

Thanks for any help. I will be testing with the REST API to see if the JSON is being returned with null colors in these cases, just to prove that this isn't only an issue with the Java library itself. I will also be filling an issue with Google about this, but maybe somebody can figure out a solution in the interim.

Thanks!
Jerri

Jerri Kohl

unread,
Apr 12, 2021, 10:07:52 AM4/12/21
to Google Calendar API
I have verified that the REST API is indeed also returning null for the colorId for these events, so this is a global issue, and not just relegated to the Java API.

Jerri Kohl

unread,
Apr 12, 2021, 11:36:00 AM4/12/21
to Google Calendar API
It would seem that this was caused by the calendar color being the same color as the color used for the events to be processed. When a color isn't set, the default calendar color is shown for the event, but the event color is returned as null. It was particularly confusing as some of the events were set to that color but many were not, with the identical calendar color showing up. However, when I would specifically set the color of the event to another color and then back to this specific color, the colorId for the event would still be null.

This seems to be a bug to me. In my mind, the color of the event should always be returned, even if the user let the event be colored the default calendar color. However, even barring that, when the user creates an event, but doesn't assign it a color, letting the default calendar color be used, but later does assign it to a different color, and then later still assigns it to the same color as the calendar color, that color should be returned, and I believe that the color should additionally no longer be changed when the user changes the calendar color. For that functionality, there should be a color option which is "calendar color".

Additionally, it would seem to be a bug that throughout this calendar, randomly, events that have the calendar color also have the event color set. This is what made this even more confusing to me when debugging this issue. These events are sprinkled throughout the calendar, so it doesn't seem to be connected to when the calendar color was set to this color, but perhaps my client was periodically changing the calendar color for some reason.

Perhaps the best solution would be for the calendar color options not to include the event color options. When a user selects a calendar color that is not amongst the event color options, all of these problems are avoided.
Reply all
Reply to author
Forward
0 new messages