I'm trying to filter the call toGetFolderByServerRelativeUrl
by using the Sharepoint API based on TimeLastModified
or any Modification or Creation date, but I couldn't succeed.
https://mycompany.sharepoint.com/sites/myTeam/_api/web/GetFolderByServerRelativeUrl('/sites/MyTeam/Shared%20Documents/My%20Project')?$expand=Files&$filter=TimeLastModified ge datetime'2023-12-11T00:00:00Z' and TimeLastModified le datetime'2024-01-05T00:00:00Z'
I'm getting all the items in the folder and not the ones created or modified on the requested date.
The documentation seems Deprecated:
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest
https://neganov.blogspot.com/2013/06/filtering-items-by-date-range-using.html
Changing the request to the following should resolve your issue:
https://mycompany.sharepoint.com/sites/myTeam/_api/web/GetFolderByServerRelativeUrl('/sites/MyTeam/Shared%20Documents/My%20Project')/Files?$filter=TimeLastModified ge datetime'2023-12-11T00:00:00Z' and TimeLastModified le datetime'2024-01-05T00:00:00Z'