How to set EventColorId using Google Calendar

How to set an EventColorId when creating a new Google Calendar Event

Date Entered: 02/24/2015    Last Updated: 02/24/2015

When creating a Google Event using the GCalendar component you can also set an EventColorId. In order set the color you will need to set a configuration setting called "EventColorId".

The EventColorId configuration setting specifies the Id of the color for the event. It can also be set when calling the UpdateEvent method.

At the moment of this writing Google comes with predefined color combination Ids which rage from 1 to 11. The EventColorId configuration setting can be set to any number between the range 1-11.

For Example gcalendar.Config("EventColorId=10")

If you need to find more information about each color combination you can use the GoogleRequest component to make an HTTP Get request to https://www.googleapis.com/calendar/v3/colors

For Example: grequest.Get("https://www.googleapis.com/calendar/v3/colors"); grequest.XPath = "/json/calendar"; int childCount = grequest.XChildren.Count; for (int i = 1; i <= childCount; i++) { Console.WriteLine(grequest.XPath = "/json/calendar/[" + i.ToString() + "]/background"); Console.WriteLine("Background Color : " + grequest.XText); Console.WriteLine(grequest.XPath = "/json/calendar/[" + i.ToString() + "]/foreground");s Console.WriteLine("Foreground Color: " + grequest.XText); }

Please refer to the help file for more details about the GoogleRequest component.


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.