Following the graph rest api tutorial:
https://learn.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0
I have added it to the fields
SELECT_FIELDS = ['id', 'webLink','from', 'toRecipients', 'receivedDateTime',
'subject', 'body', 'lastModifiedDateTime','hasAttachments', 'attachments']
async def get_next_page(self, next_link: str):
query_params = MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
select=self.SELECT_FIELDS,
top=self.TOP_VALUE,
orderby=self.ORDER_BY
)
request_config = MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration(
query_parameters=query_params
)
# Needs this header otherwise HTML is also thrown in with body
request_config.headers.add('Prefer', self.HEADER_PREFER)
request_config.headers.add('Another-Header', self.HEADER_ANOTHER)
messages = await self.user_client.me.mail_folders.with_url(next_link).get(
request_configuration=request_config)
return messages
But this does not return the unique email identifier inside the additional data object.
MailFolder(
additional_data={
'@odata.etag': 'W/"CQAAABYAAAAiTsQ6ywwrSr....FSDKJSDF"',
'lastModifiedDateTime': DateTime(2024, 7, 26, 19, 1, 21, tzinfo=Timezone('UTC')),
'receivedDateTime': DateTime(2024, 7, 26, 18, 1, 52, tzinfo=Timezone('UTC')),
'hasAttachments': True,
'subject': 'test subject',
'webLink': 'https://outlook.live.com/owa/?ItemID=AQMkADAwAT....KSJDHFKS,
'body': {
'contentType': 'text',
'content': 'random content'
},
'toRecipients': [
{
'emailAddress': {
'name': 'redacted_name',
'address': '[email protected]'
}
},
{
'emailAddress': {
'name': 'redacted_name',
'address': '[email protected]'
}
}
]
},
id='AQMkADAwATM3ZmYBLTgyM...SDKJGNKSDJHNGFKSD',
odata_type=None,
child_folder_count=None,
child_folders=None,
display_name=None,
is_hidden=None,
message_rules=None,
messages=None,
multi_value_extended_properties=None,
parent_folder_id=None,
single_value_extended_properties=None,
total_item_count=None,
unread_item_count=None
)
The id
provided in the response is the email folder’s id. So the next 4 json objects had the same id
….'AQMkADAwA...'
How do I get the unique email message id
to appear in my response?