I am using the .net SDK. Trying to filter a large list with Microsoft Graph,
My query works fine using .Items.Request().Expand("fields").GetAsync();
However, if I add a filter, it doesn't work as expected. 
I have tried two approaches :
Add .Expand("fields").Filter("fields/Archived eq false").GetAsync();  That works, but returns all the list items without filtering.
Add .Expand("fields($filter=Archived eq false)").GetAsync();
This does not work - it gives me an error that expand, select, and filter are the only allowed queries.
What does work is ("fields($select=Archived)"), but of course, no filtering is done.
So how are we to query large lists using Microsoft Graph?
You need to quote the value you pass into your filter: Fields/Archived eq 'false' (note the 's):
var result = graphClient
    .Sites["root"]
    .SiteWithPath("siteId")
    .Lists["listId"]
    .Items
    .Request()
    .Expand("Fields")
    .Filter("Fields/Archived eq 'false'");
After too much research on this issue i found below solution and its working fine for me:
To Filter you need to add Header parameter as follow: Prefer : HonorNonIndexedQueriesWarningMayFailRandomly
And Graph api will be as follow: &$filter = Fields/Archived eq False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With