Skip to content

Commit 91079d6

Browse files
authored
Update calendar.py
Add hex_color property to Calendar(). If a user sets a custom calendar color on outlook.com currently Calendar() will call CalendarColor.from_value(color) to convert it to a pre-defined color, but there are use cases where getting the actual color id is better suited. hexColor is a defined property according to https://learn.microsoft.com/en-us/graph/api/resources/calendar?view=graph-rest-1.0, and it is readily available for querying cloud_data = ['id', 'name', 'color', 'hexColor', 'isDefaultCalendar', 'changeKey', 'canShare', 'canViewPrivateItems', 'canEdit', 'allowedOnlineMeetingProviders', 'defaultOnlineMeetingProvider', 'isTallyingResponses', 'isRemovable', 'owner']
1 parent 2b5b065 commit 91079d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

O365/calendar.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,10 @@ def __init__(self, *, parent=None, con=None, **kwargs):
16131613
self.can_share = cloud_data.get(self._cc('canShare'), False)
16141614
self.can_view_private_items = cloud_data.get(
16151615
self._cc('canViewPrivateItems'), False)
1616+
1617+
# Hex color only returns a value when a custom calandar is set
1618+
# Hex color is read-only, cannot be used to set calendar's color
1619+
self.hex_color = cloud_data.get(self._cc('hexColor'), None)
16161620

16171621
def __str__(self):
16181622
return self.__repr__()

0 commit comments

Comments
 (0)