0

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.

1
  • 2
    Use this https://graph.microsoft.com/v1.0/sites/SiteID/lists/ListIF/items?expand=fields&$filter=fields/Modified gt '2025-02-27' Commented Apr 30 at 4:19

2 Answers 2

0

Note that: In your scenario, filtering based on certain properties returned by the Microsoft Graph API—such as lastModifiedDateTime or createdDateTime—is not supported.

  • For example, using a query like /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'

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, this is exactly what I was looking for and works as expected. Can I ask where you found this? i don't see it documented anywhere.
0

The endpoint sites/{site-id}/lists/{list-id}/items doesn't support filtering by the lastModifiedDateTime property, but you can filter items by the Modified field.

Values in lastModifiedDateTime and Modified are identical for each item.

/sites/{site-id}/lists/{list-id}/items?$filter=fields/Modified ge '2025-04-29T00:00:00Z'

For some reason the field name Modified is case sensitive

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.