Search code examples
microsoft-graph-apimicrosoft-graph-mail

Microsoft Graph - Invalid filter clause - conversationId


I am trying to filter by conversationId to get messages and replies for mail, but I am getting an error each time:

 {
    "error": {
        "code": "BadRequest",
        "message": "Invalid filter clause",
        "innerError": {
            "date": "2020-08-24T23:12:43",
            "request-id": "9d1c128a-d97c-4fc4-97b4-5264e566bef8"
        }
    }
}

The request path outputs like this:

https://graph.microsoft.com/v1.0/me/messages?$filter=conversationId eq 'AAQkADJkZTNiN2ZlLTg2M2QtNGZjMC1hNDUxLTdlNjgzZDVjZDljMAAQAKVNpsZfVhlEtPFltSQuNJ8='

When trying the exact same path in Graph Explorer there is no issue at all.


Solution

  • Its mostly likely the code your using is munging the URL when its sending it because of the BASE64 string isn't URI safe. Eg your request doesn't work for me in the Graph Explorer (i get the exact error you state) unless the value is escaped like

    https://graph.microsoft.com/v1.0/me/messages?$filter=conversationId eq 'AAQkADJkZTNiN2ZlLTg2M2QtNGZjMC1hNDUxLTdlNjgzZDVjZDljMAAQAKVNpsZfVhlEtPFltSQuNJ8%3D'
    

    So you need to look into what actually is being sent over the wire by your app.