I'm using the python MS graph sdk to try to perform a query. I'm able to successfully get all of the user's emails, but I can't seem to be able to use the sdk to get the emails from a certain time range. I've searched the their repo
https://github.com/microsoftgraph/msgraph-sdk-python
and also googled for quite a while and there doesn't seem to be any examples on how to do so.
Anyone have an idea of how to do it?
MAIL_FOLDER_ID = "inbox"
SELECT_FIELDS = [
"id",
"webLink",
"from",
"toRecipients",
"receivedDateTime",
"subject",
"body",
"lastModifiedDateTime",
"hasAttachments",
"attachments",
"bodyPreview",
]
TOP_VALUE = 1000
ORDER_BY = ["receivedDateTime DESC"]
SCOPES = ["https://graph.microsoft.com/.default"]
query_params = (
MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
select=SELECT_FIELDS, top=TOP_VALUE, orderby=ORDER_BY
)
)
self.request_config = (
MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration(
query_parameters=query_params
)
)
page = (
await self.graphClient
.me
.mail_folders.by_mail_folder_id(MAIL_FOLDER_ID)
.messages.get(request_configuration=self.request_config)
)