Getting files modified after a provided date - SharePoint and OneDrive

Ivan Kirinčić 25 Reputation points
2024-01-23T11:42:17.7+00:00

Hi, I'm trying to get all the files modified after a provided date for a SharePoint site or an Onedrive.

I navigate recursively through all the children for a drive but the /children endpoint does not support a filter.

Using drive/list/items has the same filtering limitations.

I looked at the /delta endpoint and it has the option to provide a date(https://learn.microsoft.com/en-us/graph/api/driveitem-delta?view=graph-rest-1.0&tabs=http#example-4-retrieving-delta-results-using-a-timestamp) but I noticed the date can't be older than 2 months and the results can be older then provided date.

I tried using /search, but I got no results: "drives/{'id'}/root/search(q='lastModifiedDateTime ge 2023-07-31T18:56:29Z')"

Questions:

Is there a way to get files modified after a provided date for SharePoint or Onedrive?

Am I stuck going recursively over the children and performing the filtering on my end?

Is there at least an endpoint to get all the data without recursive queries?

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | OneDrive | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-01-25T09:38:26.5+00:00

    Hi @Ivan Kirinčić, We are unable to get all files filtered by modified date from the whole site. But we could get files from list and filter by Modified. Please refer to following

       https://graph.microsoft.com/v1.0/sites/example.sharepoint.com:/sites/development:/lists/<listid>/items?$filter=fields/Modified eq '2024-01-01T08:23:03Z'  
    

    ---If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.