To filter Microsoft Graph API responses, the docs suggest to use the filter
query option.
Here I've used startswith
and endswith
string functions on the '/me/messages'
endpoint.
query = {
'$filter': "
startswith(from/emailAddress/address, 'abcd')
or endswith(from/emailAddress/address, 'gmail.com')"
}
Only using startswith
returns the expected response. On adding the endswith
function to the filter query, the response received is an error.
{
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"request-id": "0d12e1f6-6105-4826-9656-8613f8c167ed",
"date": "2019-03-14T11:05:56"
}
}
}