Home > Blockchain >  'Invalid filter clause' while using 'ReceivedDateTime' in GRAPH API
'Invalid filter clause' while using 'ReceivedDateTime' in GRAPH API

Time:10-07

I am writing a script to read a mailbox every 1hr and download its attachments. I am following [this][1] python tutorial Below is my code to get emails for the day

def get_all_msg(self):
    endpoint = "/me/mailFolders/inbox/messages?$filter=ReceivedDateTime ge '2022-10-05T08:40:20Z'"

    request_url = f'{endpoint}'

    inbox_response = self.user_client.get(request_url)
    return inbox_response.json() 

This gives the following error

{'error': {'code': 'BadRequest', 'message': 'Invalid filter clause', 'innerError': {'date': '2022-10-06T09:40:20', 'request-id': '4b76e1be-6f5b-45b6-90e7-c374673b3543', 'client-request-id': '11281235-f9a1-4dbc-a9e4-bedd85d46145'}}}

Not sure whats wrong. Any help is appriciated [1]: enter image description here

Please see the docs for more info - enter image description here

Hope this helps Thanks

  • Related