Outlook 365 filter query - problem with filtering messages by categories that start with specific words

Describe the problem/error/question

I’m trying to limit messages that are received by Microsoft Outlook 365 node. I want to receive only messages that have a category that starts with ‘test-’.
Problem is that those filter queries do not work and I get the message “The query filter contains one or more invalid nodes.”.

Filter query that works:
categories/any(a:a eq ‘test-’)

Filter queries that do not work, but they should:

categories/any(a:startswith(a,'test-'))
categories/any(a:contains(a,'test-'))

What is the error message (if any)?

{
  "errorMessage": "The query filter contains one or more invalid nodes.",
  "errorDetails": {
    "rawErrorMessage": [
      "400 - {\"error\":{\"code\":\"ErrorInvalidUrlQueryFilter\",\"message\":\"The query filter contains one or more invalid nodes.\"}}"
    ],
    "httpCode": "400"
  },
  "n8nDetails": {
    "nodeName": "Microsoft Outlook",
    "nodeType": "n8n-nodes-base.microsoftOutlook",
    "nodeVersion": 2,
    "resource": "message",
    "operation": "getAll",
    "itemIndex": 0,
    "time": "16.04.2024, 18:07:08",
    "n8nVersion": "1.36.4 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: The query filter contains one or more invalid nodes.",
      "    at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1264:19)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1986:20)",
      "    at Object.microsoftApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Outlook/v2/transport/index.js:28:16)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Outlook/v2/actions/message/getAll.operation.js:252:24)",
      "    at Object.router (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Outlook/v2/actions/router.js:69:36)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Outlook/v2/MicrosoftOutlookV2.node.js:16:16)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:660:53",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1062:20"
    ]
  }
}

Please share your workflow

Information on your n8n setup

  • n8n version: 1.36.4
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04.4

hello @ofc_edu

Well… the proper syntax is startsWith, but it seems that it’s not supported for categories property

1 Like

startswith(subject,'info') works, but with subject property.
categories/any(a:a eq 'test-') also works, but I need to find all emails with category name that start (or at least contain) that word, as category full name is generated dynamically (usually they look like test-x7ds8aCD ), so equal is not the solution for my case.

It seems that this is Microsoft Graph query problem, not this specific node problem. I’m trying to get the proper syntax from MS Graph forum, will post if I get it.

In the end it seems that indeed startswith is not supported for categories property.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.