I am trying to filter a SharePoint List of Items to only get those that were modified within the past day. According to the following Graph API documents, I should be able to use the
$filter=lastModifiedDateTime ge {24 hours ago}
query parameter
https://learn.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0
https://learn.microsoft.com/en-us/graph/api/resources/listitem?view=graph-rest-1.0
A sample URL I am using is:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$filter=lastModifiedDateTime ge 2025-04-28T00:00:00Z
I am getting back an "Invalid request" from Microsoft without any real reason why.
If I dont add a filter, I am able to return all the items without issue.
Note that: In your scenario, filtering based on certain properties returned by the Microsoft Graph API—such as lastModifiedDateTime
or createdDateTime
—is not supported.
/items?$filter=lastModifiedDateTime ge '2025-02-27'
will result in an "Invalid request" error.To resolve the issue, you need to make use of the auto generated SharePoint list item fields Created or Modified:
Hence to filter SharePoint List Items use the below query:
https://graph.microsoft.com/v1.0/sites/SiteID/lists/ListID/items?expand=fields&$filter=fields/Modified gt '2025-02-27'