Skip to content

MsGraph Todo $filter works incorrectly when have combination of and\or logic conditions #2967

@23W

Description

@23W

Describe the bug

My app needs requesting ToDo tasks by MsGraph API from some list and filtering criteria:

  • get all tasks that have either Start or Due dates
  • and their Title contains some specific text.

So app does following request:

graphClient.Me.Todo.Lists[myListId].Tasks.GetAsync(rc => rc.QueryParameters.Filter = filter)

where filter is string "contains(title, '[SPECIFIC_TEXT]') and (startDateTime/dateTime ne null or dueDateTime/dateTime ne null)"

Ms Graph processes this request incorrectly.
It returns result that ignores contains(title, '[SPECIFIC_TEXT]') criteria and filters by startDateTime/dateTime ne null or dueDateTime/dateTime ne null only.

The more interesting if i do both filtering separately they works good and return correct result:

  • filtering by Title only:
filter="contains(title, '[SPECIFIC_TEXT]')";
  • filtering by presence of Start\Due dates only:
filter="startDateTime/dateTime ne null or dueDateTime/dateTime ne null";

So it seems filtering works incorrectly when have combination of criteria connected by logical operations "and\or".
I read whole documentation about filtering in MsGraph and sure that my filtering request is built correctly. It seems that MsGraph ToDo service has a bug with filtering.
Could you please advice me how to build filtering request so MsGraph will process it and return correct result?

Expected behavior

MsGrpah should return tasks that are filtered according criteria

How to reproduce

use filter "contains(title, '[SPECIFIC_TEXT]') and (startDateTime/dateTime ne null or dueDateTime/dateTime ne null)"

SDK Version

5.73.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions