microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

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

Open
#2,967 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Service issue
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

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_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request through graphClient.Me.Todo.Lists[myListId].Tasks.GetAsync with the documented filter string and SDK version 5.73.0. Compare the returned tasks with the expected title and Start/Due date criteria; done means the combined filter returns only matching tasks or the service limitation is confirmed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.