From 5fb188b267789c4835f56fe97607822c38565f17 Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Thu, 17 Apr 2025 10:55:13 +0100 Subject: [PATCH 1/2] Add mapping for complex attributes https://github.com/O365/python-o365/issues/684 --- O365/utils/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/O365/utils/utils.py b/O365/utils/utils.py index 6e2bf6f8..09ff8309 100644 --- a/O365/utils/utils.py +++ b/O365/utils/utils.py @@ -636,6 +636,9 @@ class Query: 'flag': 'flag/flagStatus', 'body': 'body/content' } + _select_mapping = { + "meetingMessageType": "microsoft.graph.eventMessage/meetingMessageType", + } def __init__(self, attribute=None, *, protocol): """ Build a query to apply OData filters @@ -685,6 +688,7 @@ def select(self, *attributes): if '/' in attribute: # only parent attribute can be selected attribute = attribute.split('/')[0] + attribute = self._get_select_mapping(attribute) self._selects.add(attribute) else: if self._attribute: @@ -860,6 +864,10 @@ def _get_mapping(self, attribute): return attribute return None + def _get_select_mapping(self, attribute): + mapping = self._select_mapping.get(attribute) + return mapping or attribute + @fluent def new(self, attribute, operation=ChainOperator.AND): """ Combine with a new query From 50612d5448fe03139482257278292242da0916b9 Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Tue, 22 Apr 2025 10:19:47 +0100 Subject: [PATCH 2/2] Change creation of attribute for call --- O365/utils/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/O365/utils/utils.py b/O365/utils/utils.py index 09ff8309..ffe6b63e 100644 --- a/O365/utils/utils.py +++ b/O365/utils/utils.py @@ -636,9 +636,6 @@ class Query: 'flag': 'flag/flagStatus', 'body': 'body/content' } - _select_mapping = { - "meetingMessageType": "microsoft.graph.eventMessage/meetingMessageType", - } def __init__(self, attribute=None, *, protocol): """ Build a query to apply OData filters @@ -865,8 +862,11 @@ def _get_mapping(self, attribute): return None def _get_select_mapping(self, attribute): - mapping = self._select_mapping.get(attribute) - return mapping or attribute + if attribute in ["meetingMessageType"]: + return ( + f"{self.protocol.keyword_data_store['event_message_type']}/{attribute}" + ) + return attribute @fluent def new(self, attribute, operation=ChainOperator.AND):